Light Navigation Bar

lopez.mikhael picture lopez.mikhael · Apr 7, 2016 · Viewed 12.3k times · Source

I want to change the color of the navigation bar from black (w/ white icons) to white (w/ black icons).

Desired result (as seen in uCrop) :

Light Navigation Bar

I know how to change the status bar color via android:windowLightStatusBar.

Is there a similar property for the navigation bar?

Answer

nearlySane picture nearlySane · Oct 26, 2019

For API 27+, you can do this via styles:

<!-- added in API 27 -->
<item name="android:windowLightNavigationBar">true</item>

<!-- required to contrast the dark buttons -->
<item name="android:navigationBarColor">@android:color/white</item>

<!-- optional -->
<item name="android:navigationBarDividerColor">@android:color/black</item>

While the XML attribute was introduced in API 27, the support for a light navigation bar was introduced one version earlier, in API 26, via SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.

Therefore, to target the earliest devices that support it, you'll have do it via code, rather than XML styles.