Android屏幕中隐藏标题栏和状态栏

第一种方法,通过代码实现:
在Activity的setContextView()方法之前调用:

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//隐藏标题栏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); //隐藏状态栏

第二种方法,通过配置实现:
在AndroidManifest.xml文件的对应Activity的Application节点中添加:

android:theme="@android:style/Theme.NoTitleBar" <!--无标题栏-->
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
<!--无标题栏和状态栏-->
posted @ 2011-05-22 15:23  漂泊的云  阅读(623)  评论(0编辑  收藏  举报