Android 去掉窗口标题和程序全屏


第一:在程序代码中实现

this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);//去掉信息栏

注意:这两行代码要写在页面显示之前,即setContentView(R.layout.XXX)之前

第二:在AndroidManifest.xml配置文件中实现标签android:theme

<activity android:name="Activity1"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"></activity>

注意:如果不需要全屏,只需要写成android:theme="@android:style/Theme.NoTitleBar即可

相关内容