如何从应用程序中删除标题栏? [英] How do I remove the title bar from my app?

查看:106
本文介绍了如何从应用程序中删除标题栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,顶部有一个标题栏,该菜单的上方是溢出菜单,但我不需要设置,只有一个屏幕.当我像其他许多问题中所述更改主题时,会得到旧的2.2主题.我想拥有一个现代主题,而顶部没有栏.

In my app there is this title bar at the top where the overflow menu would be, but I don't need settings and only have one screen. When I change the theme like described in many other questions I get the old 2.2 theme. I want to have the modern theme just without the bar at the top.

推荐答案

转到styles.xml并将 .DarkActionBar 更改为 .NoActionBar

Go to styles.xml and change .DarkActionBar for .NoActionBar

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
</style>

成为

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
</style>

如果颜色与您的应用无关,则可以实际使用

if colors are irrelevant to your app, you can actually go for

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" />

这篇关于如何从应用程序中删除标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆