4

I try to change the color of the navigation bar, either via a theme, or programmatically.

Here is what I tried so far:

in 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>

programmatically:

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

The problem is: it works perfectly on Nexus devices (with Android 7.1.1), but not on a LG Q6 (also with Android 7.1.1).

I think there is a way to do it (since the Youtube app has its own navigation bar color), but I don't know how.

I also tried pretty much everything here, here, here, here and here, with no success.

Thanks for your help!

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
matteoh
  • 2,810
  • 2
  • 29
  • 54
  • Running into this as well, all devices we've tested default to a black navigation bar, except for my LG V20 which displays a light navigation bar. Everything I've tried so far hasn't changed the navigation bar color on my V20 – Robert Rouhani Aug 18 '18 at 17:02

1 Answers1

2

Try to use

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

in your AndroidManifest.xml

  • Looks like without this tag declared, some vendors disable some features, because you not guarantee wide-screen support. It's my guess though, I found it in experimental way. – Dmitry Chistyakov Sep 09 '19 at 08:10