Change Device Navigation Bar Color [CODENAME ONE]

Viewed 35

How would one go about changing device navigation bar color in Codename one? I recently learned to change the color of the status bar, and I would like to do the same for the device's navigation bar.

enter image description here

2 Answers

This isn't an editable area, I'm sure there are ways to override that but it's probably not what you want. This is a part of the device control. The device determines the colors based on light/dark theme of application.

To make it work as dark you can use the build hint android.theme=Dark otherwise it should take the color based on device mode.

I found the solution by adding a color.xml file to the native android resources folder with the following line of code:

android/src/main/resources/colors.xml

<resources>
    <color name="navigationBarColor">#ff000000</color>
</resources>

With this line of code, the navigation bar is rendered "black".

Refernces:

Change the color of the status bar in codenameone

Change navigation bar color

Related