Is there an easy way to change the icon for the Android BottomBar
navigation (https://github.com/roughike/BottomBar). I have seen a number of ways to set this icon, but I would like to change the icon when the user selects it. Currently I have an icon, with outline, and I would like to display a filled icon when they select it. Any help would be great.
Asked
Active
Viewed 776 times
1

BlackHatSamurai
- 23,275
- 22
- 95
- 156
2 Answers
1
It looks like the guys at BottomBar
decided to incorporate this. They added the ability in 2.2.0:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_myicon_selected" android:state_selected="true" />
<item android:drawable="@drawable/ic_myicon_default" android:state_selected="false" />
</selector>
You can find the reference here.

BlackHatSamurai
- 23,275
- 22
- 95
- 156
0
There seems to be a getter and setter for the iconResId
in the source file.
Have you given that a go?
Create an object of BottomBarTab() and call this setter method in the OnItemSelected with your desired icon choice. https://github.com/roughike/BottomBar/blob/master/bottom-bar/src/main/java/com/roughike/bottombar/BottomBarTab.java#L175

harshithdwivedi
- 1,411
- 16
- 37
-
Well, that's strange. I'd suggest opening an issue on github as the author would know what's the best way to do it. – harshithdwivedi Jan 03 '17 at 20:15
-
1I did. Lol... I'm hoping to hear something back soon. – BlackHatSamurai Jan 03 '17 at 20:27