【问题标题】:Action Bar on Android is still showing despite using NoActionBar theme尽管使用 NoActionBar 主题,Android 上的 Action Bar 仍然显示
【发布时间】:2023-01-16 13:58:13
【问题描述】:

我正在为我的 Android 应用程序使用主题 Theme.MaterialComponents.DayNight.NoActionBar (docs)。

我还在 MainActivity 中调用 getActionBar().hide()

在我几乎所有的设备上,操作栏都没有显示。但是,在一台运行 Android 12 的 Pixel 6 设备上,我仍然可以看到操作栏。我确定我已经安装了最新版本的应用程序。

知道为什么 Action Bar 仍然挂在这台设备上吗?

【问题讨论】:

    标签: android android-actionbar android-12 google-pixel


    【解决方案1】:

    我遇到了同样的问题(我想),直到我意识到我已经在我的 values/themes.xml 中设置了 .NoActionBar 样式,但没有在我的 values-night/themes.xml 中设置,并且有“问题”的设备处于暗模式.

    解决方案: 在 values/themes.xml 和 values-night/themes.xml 中设置 Theme.MaterialComponents.DayNight.NoActionBar。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多