android去掉系统默认标题栏

android自动生成的project中会包含标题栏,类似效果如下:

1.png

可是我们希望的效果是这样的:

2.png

那么,how to do?其实很简单,我们只需要在Mainfast.xml配置文件中做修改即可,修改android:theme= 即可。
例如,原app主题配置是这样的:

   <application
        android:name="com.test.app.AppContext"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

      //其它配置
        //......
       </application>

我们只需要把 android:theme="@style/AppTheme" 替换成 android:theme="@style/Theme.AppCompat.NoActionBar"即可,替换后代码是这样的:

  <application
        android:name="com.test.app.AppContext"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.AppCompat.NoActionBar">

        //其它配置
        //......
    </application>

替换之后便可实现无标题栏效果了。谢谢诶。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容