美文网首页
标题栏隐藏——终结版,哈哈!

标题栏隐藏——终结版,哈哈!

作者: Ling912 | 来源:发表于2016-04-28 11:50 被阅读41次

先贴个原文地址:

看完本文不懂的请移步---> 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

style.xml

AndroidManifest中引用(activity标签中)

android:theme="@style/myNoTitleBarStyle"

3.当然也可以直接引用Android自带的,但不保证所有都有效喔

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

4.终结版:

res/valuesres/values-11 和 res/values-14 styles.xml

res/values res/values-11 res/values-14

最后的引用还是一样,其实上面那三,只需要加入中间那个noTitle就可以啦

android:theme="@style/Theme.NoTitle"

(来点题外的)

全屏也就是说移除通知栏

//Remove notification bar

this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN)

相关文章

网友评论

      本文标题:标题栏隐藏——终结版,哈哈!

      本文链接:https://www.haomeiwen.com/subject/qychrttx.html