android - 在 LG Q6 上以编程方式更改导航栏颜色

标签 android navigationbar

我尝试通过主题或编程方式更改导航栏的颜色。

到目前为止,这是我尝试过的:

在 style-v21 中:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimary">#123456</item>
    <item name="colorPrimaryDark">#012345</item>
    <item name="colorAccent">#987654</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:navigationBarColor">@color/colorAccent</item>
</style>

以编程方式:

Window w = getWindow();
w.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
w.setNavigationBarColor(ContextCompat.getColor(this, R.color.colorAccent));

问题是:它在 Nexus 设备(Android 7.1.1)上运行良好,但在 LG Q6(也与 Android 7.1.1)上运行不正常。

我认为有办法做到这一点(因为 Youtube 应用程序有自己的导航栏颜色),但我不知道怎么做。

我也尝试了几乎所有 hereherehereherehere ,但没有成功。

感谢您的帮助!

最佳答案

尝试使用

<application>
....
<meta-data android:name="android.max_aspect" android:value="2.5" />
...
</application>

在你的 AndroidManifest.xml 中

关于android - 在 LG Q6 上以编程方式更改导航栏颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50723623/

相关文章:

javascript - 菜单导航栏网页: dynamic menu windows.画面

ios - 为什么 TableView 显示在导航栏下方

html - 调整页面大小不会转到没有绝对宽度的滚动条

jquery - html导航栏不检测是否打开

java - 安卓Java : BoofCV Integration Problems

android - 将我的应用程序连接到 wamp 服务器

android - 如何获取 android NDK 详细崩溃报告?

java - 如何四舍五入经度和纬度值

android - indic-text-renderer 使用 harfbuzz 和 freetype

ios - 当 tableview 在 swift 4 中滚动时,导航栏背景颜色会变成错误的颜色