我尝试通过主题或编程方式更改导航栏的颜色。
到目前为止,这是我尝试过的:
在 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 应用程序有自己的导航栏颜色),但我不知道怎么做。
我也尝试了几乎所有 here 、 here 、 here 、 here 和 here ,但没有成功。
感谢您的帮助!
最佳答案
尝试使用
<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/