Android取消标题方法和this.requestWindowFeature(Window.FEATURE_NO_TITLE)App报错解决方法
2017-11-24 13:00
1056 查看
1. this.requestWindowFeature(Window.FEATURE_NO_TITLE); 这个一定要在setContentView()之前。
如果这个方法会使App停止无法运行,或者标题并没有隐藏。
1. 可以通过 MainActivity extends Activity
2.MainActivity extends AppcompatActivity在onCreate(Bundle savedInstanceState)方法中加上如下代码:
if(getSupportActionBar()!=null){
getSupportActionBar().hide();
}
2. 在清单文件(manifest.xml)里面实现:
如果只需要在一个Activity设置成一个无标题栏的形式,只要把下面的第三行代码写到某一个Activity里面就可以了。
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
3..在style.xml文件里定义:
<?xml version="1.0" encoding="UTF-8" ?>
<resources>
<style name="notitle">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
然后面manifest.xml中引用就可以了
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/notitle">
相关文章推荐
- 【Android】使用requestWindowFeature(Window.FEATURE_NO_TITLE)方法去除标题无效解决办法
- android 取消标题 程序意外停止(this.requestWindowFeature(Window.FEATURE_NO_TITLE);)
- Android使用requestWindowFeature(Window.FEATURE_NO_TITLE)方法去除标题无效解决办法
- Android requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- 在Android Stduio 中使用requestWindowFeature(Window.FEATURE_NO_TITLE)无效的解决方法
- Android设置requestWindowFeature(Window.FEATURE_NO_TITLE)无效的解决办法
- requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- requestWindowFeature(Window.FEATURE_NO_TITLE);在程序中不起作用的解决方法
- Android 中无法取消标题栏的问题,requestWindowFeature(Window.FEATURE_NO_TITLE);无效
- requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- 使用requestWindowFeature(Window.FEATURE_NO_TITLE)去掉标题栏失效的解决方法
- requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- 今天记录一下小小的知识点--如何让你的Android应用没有标题 --- requestWindowFeature(Window.FEATURE_NO_TITLE);
- requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- android5.0使用requestWindowFeature(Window.FEATURE_NO_TITLE)隐藏标题栏的报错的解决方法
- requestWindowFeature(Window.FEATURE_NO_TITLE)无效解决方法
- Android问题:设置了requestWindowfeature(window.feature_no_title)后,为什么还要getwindow.setFlags?
- this.requestWindowFeature(Window.FEATURE_NO_TITLE)相关