Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change system navigation bar color

In guidelines of Android 5.0, the navigation bar seems customizable: http://www.google.com/design/spec/layout/structure.html#structure-system-bars

How can I change the navigation bar color? I would like to use a white style.

Screenshots: enter image description hereenter image description hereenter image description hereenter image description here


Edit: In my resources, I tested the style:

<item name="android:navigationBarColor" tools:targetApi="21">@android:color/white</item>

But the buttons are white. I would like the same renderer as the second image.

enter image description here

like image 885
alex Avatar asked Dec 07 '14 21:12

alex


People also ask

How can I change the color of my menu bar in Android?

Just go to res/values/styles.edit the xml file to change the color of action bar.

How do I customize my navigation bar?

From Settings, tap Display, and then tap Navigation bar. Make sure Buttons is selected, and then you can choose your desired button setup at the bottom of the screen. Note: This option will also affect the location you swipe when using Swipe gestures.


2 Answers

Starting from API 27, it is now possible to use the light style of the navigation bar:

<item name="android:navigationBarColor">@android:color/white</item>
<item name="android:windowLightNavigationBar">true</item>

From the documentation:

windowLightNavigationBar

If set, the navigation bar will be drawn such that it is compatible with a light navigation bar background.

For this to take effect, the window must be drawing the system bar backgrounds with windowDrawsSystemBarBackgrounds and the navigation bar must not have been requested to be translucent with windowTranslucentNavigation. Corresponds to setting SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR on the decor view.

like image 110
EyesClear Avatar answered Oct 17 '22 16:10

EyesClear


Use this in your Activity.

 if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setNavigationBarColor(getResources().getColor(R.color.green));
    }
like image 33
Roadies Avatar answered Oct 17 '22 15:10

Roadies