android开发去除标题栏的方法
作者:杭州小白 时间:2021-06-30 19:11:29
1:新建一个项目运行起来,可以看到顶部一直有个标题栏看着不是很美观
2:有两种方法可以去除顶部标题栏
(1)将代码中AndroidManifest里android:theme="@style/Theme.MyApplication"改为android:theme="@style/Theme.AppCompat.NoActionBar">
<application
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.NoActionBar"
>
(2)在themes.xml文件里改,选中MyApplication,Ctrl+鼠标点击
来到themes.xml文件里,把代码中parent="Theme.MaterialComponents.DayNight.DarkActionBar"替换为
parent=“Theme.AppCompat.Light.NoActionBar”
<style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
3:效果展示
来源:https://blog.csdn.net/weixin_44941105/article/details/116076590
标签:android,标题栏
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
手写java性能测试框架第二版
2023-03-15 14:07:31
C#中循环语句:while、for、foreach的使用
2022-05-01 02:42:55
Java class文件格式之属性_动力节点Java学院整理
2021-06-13 01:52:00
![](https://img.aspxhome.com/file/2023/4/101944_0s.png)
C#二维数组与多维数组的具体使用
2023-07-30 23:53:49
![](https://img.aspxhome.com/file/2023/5/82185_0s.jpg)
Java详细讲解不同版本的接口语法和抽象类与接口的区别
2022-09-30 01:46:38
![](https://img.aspxhome.com/file/2023/5/61875_0s.png)
java调用外部程序的方法及代码演示
2023-11-13 22:42:55
Unity的IPostBuildPlayerScriptDLLs实用案例深入解析
2022-12-23 00:12:38
C#绘制中国象棋棋盘
2021-05-27 15:08:44
![](https://img.aspxhome.com/file/2023/1/94551_0s.jpg)
Java实现在Word指定位置插入分页符
2021-06-29 03:24:44
![](https://img.aspxhome.com/file/2023/1/75451_0s.png)
C#中abstract的用法详解
2021-07-08 21:53:46
Struts2中异常处理机制分析
2023-11-17 21:54:32
mongo分布式锁Java实现方法(推荐)
2023-06-30 21:28:43
![](https://img.aspxhome.com/file/2023/8/78248_0s.jpg)
Android多渠道打包的方法步骤
2022-10-17 12:05:07
![](https://img.aspxhome.com/file/2023/4/91024_0s.png)
在Java中按值调用和按引用调用
2021-12-26 20:09:21
不规范使用ThreadLocal导致bug分析解决
2023-11-24 20:03:59
![](https://img.aspxhome.com/file/2023/2/59182_0s.png)
冒泡排序算法原理及JAVA实现代码
2022-08-13 10:30:40
浅谈@RequestMapping注解的注意点
2023-07-11 02:12:39
unity使用射线实现贴花系统
2023-04-23 10:22:00
![](https://img.aspxhome.com/file/2023/4/108694_0s.jpg)
java.util.ArrayDeque类使用方法详解
2022-12-13 11:19:02
java获取当前时间的四种方法代码实例
2023-11-28 19:22:53