先贴个原文地址:
看完本文不懂的请移步---> http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme?answertab=votes#tab-top
1. Activity代码中:
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
说明:这句必须在setcontent()之前调用,否则无效!否则无效!否则无效!
2.在 style.xml 中加入一个 style,然后在 AndroidManifest 中把 activity 的 style 设置成这
style.xml
![](https://img.haomeiwen.com/i1425272/7214dcb198b05652.png)
AndroidManifest中引用(activity标签中)
android:theme="@style/myNoTitleBarStyle"
3.当然也可以直接引用Android自带的,但不保证所有都有效喔
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
4.终结版:
res/values 和 res/values-11 和 res/values-14 中 styles.xml
![](https://img.haomeiwen.com/i1425272/b73ea33db3fad6a7.png)
![](https://img.haomeiwen.com/i1425272/3de71776abc20e34.png)
![](https://img.haomeiwen.com/i1425272/ab4e095a9cb5541a.png)
最后的引用还是一样,其实上面那三,只需要加入中间那个noTitle就可以啦
android:theme="@style/Theme.NoTitle"
(来点题外的)
全屏也就是说移除通知栏
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)
网友评论