In our last post we showed you how to create a bottom navigation bar in Android using BottomNavigationView. BottomNavigationView. But how to easily change the color of menu item and text of the menu items in the bottom navigation view. It is very easy and simple to change the color of menu items and text and in this post as a sequel to the previous one we will show you how to do this.

First you need to create a new Drawable Resource file with selector as a root element. We will name it bottom_nav_item_color. In this file we will set the color of the item and the text in two situations, when the item is checked and when it isn’t checked. The code in this file will look like this:

We’ve added primary and accent but you can add any color. Next in the layout where you are using the BottomNavigationView element you need to add two more lines in the element:

Now our our BottomNavigationView will look like this:

And that’s it, the color of the icon and the text in the menu items in our bottom navigation bar is changed.

Happy coding!

 

 

Spread the love

Leave a Reply

Your email address will not be published. Required fields are marked *