现在的android项目 基本上需要全屏显示 :
以前的的三种方式有时不知道为啥会出现问题,可能版本问题吧:
比较早的 写法是
this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏这种方法 不会取消标题栏
因为现在的版本是 titleBar 和ActionBar
新的方法:
在清单文件中 更改activity的theme (去掉单个Activity的ActionBar)
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
>
我们可以点看一下系统是如何定义这个theme的
false
true
如果,需要所有的Activty都去掉标题栏 那么我们可以将清单文件的总的主体更改为
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">