Android 开发技巧杂集
2010-11-05 00:54:42 来源:WEB开发网12. findViewById(R.id.stub_import)).inflate();
1 ) 定义 ViewStub
< ViewStub android : id = "@+ id / stub _ import "
android : inflatedId ="@+ id / panel _ import "
android : layout ="@ layout / progress _ overlay "
android : layout _ width =" fill _ parent "
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>
2 )展开视图
findViewById(R.id.stub_import).setVisibility(View.VISIBLE);
// 或者 获取视图
View importPanel = ((ViewStub)
findViewById(R.id.stub_import)).inflate();
4.删除窗口背景
1) 编码实现
Java代码
1. public void onCreate(Bundle icicle){
2. super.onCreate(icicle);
3. setContentView(R.layout.mainview);
4. // 删除窗口背景
5. getWindow().setBackgroundDrawable(null);
6. ...
7. }
public void onCreate(Bundle icicle){
super.onCreate(icicle);
setContentView(R.layout.mainview);
// 删除窗口背景
getWindow().setBackgroundDrawable(null);
...
}
2 )自定义主题实现
Java代码
1. < resources>
2. < mce:style name="NoBackgroundTheme" parent="android:Theme">< !--
3. < item name="android:windowBackground">@null< /item>
4. -->< /mce:style>< style name="NoBackgroundTheme" parent="android:Theme" mce_bogus="1">< item name="android:windowBackground">@null< /item>< /style>
5. < /resources>
< resources>
< mce:style name="NoBackgroundTheme" parent="android:Theme">< !--
< item name="android:windowBackground">@null< /item>
-->< /mce:style>< style name="NoBackgroundTheme" parent="android:Theme" mce_bogus="1">< item
赞助商链接