Search code examples
androidbottomnavigationview

Android BottomNavigationBar Unique Icon Tint List for each tab?


I've been unable to find any examples of this or really any questions asking the same thing so I'm not sure yet if its possible. I have a requirement for each icon in my bottom navigation bar to be a different color. So 4 tabs, 4 icons, 4 colors. In the past i've never had to go beyond iconTintList to modify the states as my items shared a selected and deselected color.

Is it possible to set a separate TintList on each of the tab items? Another idea i've had from googling around is to set IconTintList to null, and then have each of my icons have their color in the icon itself. I lose the state control if this works, but I could force it to change icons themselves when they gain or lose focus to the correct colored icon. This seems a little hacky though.

EDIT: I can confirm the solution of setting the TintList to null and using appropriately color icons will work. Hoping I don't have to go this route, but looks like it'll satisfy my requirement if it is the only way.

Thanks


Solution

  • You can use this layout How to combine BottomAppBar + FAB with BottomNavigationView (check the marked answer) then you can easily modify each items as per your requirement.