Solution to unsuccessful removal of activity title

Record the problems encountered when setting the activity to remove the title.

There are generally two ways:

1. Set this.requestwindowfeature (window. Feature_no_title) in activity; But it must be before setcontentview.

2. Add in style file:

<item name="android:windowNoTitle">true</item>//无标题
<item name="android:windowActionBar">true</item>//无ActionBar
<item name="android:windowFullscreen">true</item>//全屏即无通知栏
<item name="android:windowContentOverlay">@null</item>//是否有遮盖

之前一直是这么实现的,而且都好用。这次写上也不好用了,问题还是没有解决,仔细看了一下,问题出在MainActivity继承的是AppCompatActivity。
解决方法
1、改为继承Activity。
2、在style文件增加 <item name="windowNoTitle">true</item>

完美解决,建议使用第二种解决方法,perfect!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>