Cordova, how to change the color of the control bar: back, home and windows

Asked

Viewed 518 times

1

I do not know the name of the component but the image below clarifies what I need, I apologize...

I need to change the color of this component in Cordova

inserir a descrição da imagem aqui

1 answer

2


Bearing in mind that the Apache Cordova transforms HTML5 + CSS + Javascript into native code, you will have to make an adaptation of the basic original code to change the color of the NavigationBarColor. Below follows two forms, both via XML and programmatically, using JAVA. See:

XML

<item name="android:navigationBarColor">@color/theme_color</item>

JAVA

window.setNavigationBarColor(@ColorInt int color)

However there are some plugins in which you may be using. As for example, the Cordova-plugin-navigationbar-color. Since you are open source, you can study and adapt according to your needs. See how it would look:

window.NavigationBar.backgroundColorByHexString('#3F51B5');

Note: the method has been introduced into Android Lollipop and will not work in API version < 21.

  • interesting I will test

  • could you cite an example of how to use ? in which xml I put this property, in config.xml ? , and meto there, is javascript ? how can I change to color : #3F51B5

  • @Jeffersonmelloolynyki You came to install this plugin?

  • yes, I’ve installed it

  • @Jeffersonmelloolynyki take a look at this file here, where the guy makes the change using the plugin: https://github.com/fagundes/cordova-plugin-navigationbar/blob/master/www/navigationbar.js

  • 1

    perfect @Ack Lay window.NavigationBar.backgroundColorByHexString('#3F51B5'); Thanks !

  • @Jeffersonmelloolynyki edited the answer and put your code there because it can help other people. Abs. Good luck.

  • opa, beauty, it will help that you are with doubts, thank you

Show 3 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.