NoActionBar 仍在物理设备上显示

发布于 2025-01-18 17:46:07 字数 1122 浏览 2 评论 0原文

所以这是我的问题:我将 NoActionBar 放在我的主题上,当我在模拟设备中运行我的应用程序时,不会显示任何操作栏(所以一切都很好),但是当我在智能手机上安装并运行该应用程序时(如果是 galaxy S8 API 28)它有什么关系)操作栏仍然显示为什么这样?

这是 theme.xml 文件:

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.DTTREALESTATE" parent="Theme.MaterialComponents.DayNight.NoActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/light_gray</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/red</item>
        <item name="colorOnSecondary">@color/white</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor">@color/light</item>
        <!-- Navigation bar color -->
        <item name="android:navigationBarColor">@color/light</item>
    </style>
</resources>

我尝试使用 DarkActionBar 来查看智能手机上显示的内容,但它没有做任何事情,它只影响模拟设备......说实话,我完全不知道如何解决这。

So here is my problem : I put NoActionBar on my themes and when i run my app in an emulated device no action bar are shown (so everthing is fine) BUT when I install and run the app on my smartphone (galaxy S8 API 28 if it has anything to with it) an action bar is still displaying why so?

Here is the themes.xml file :

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.DTTREALESTATE" parent="Theme.MaterialComponents.DayNight.NoActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/light_gray</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/red</item>
        <item name="colorOnSecondary">@color/white</item>
        <!-- Status bar color. -->
        <item name="android:statusBarColor">@color/light</item>
        <!-- Navigation bar color -->
        <item name="android:navigationBarColor">@color/light</item>
    </style>
</resources>

I tried to use the DarkActionBar to see what would be display on my smartphone but it didn't do anything it only affect the emulated devices... To be honest I have ABSOLUTLY no idea how to solve this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

没有伤那来痛 2025-01-25 17:46:07

请在两个 theme.xml 文件(白天和夜间)中添加这些行。

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

Please add these lines in both of themes.xml files (Day and night).

    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
对你再特殊 2025-01-25 17:46:07

不要忘记在两个(夜间和普通)themes.xml 文件中更改它

Don't forget to change it in both (night and normal one)themes.xml files

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文