Reputation: 11
I want when one of my icon's in my bottom navigation view when pressed to change to a particular color while the other one when pressed to change to another color. For example I want the home icon when pressed, change to red while when the profile icon is pressed change to green.Is there any way. I would appreciate any help.
Upvotes: 1
Views: 244
Reputation: 96
This post should lead you in the right direction: http://www.mkyong.com/android/android-imagebutton-selector-example/
I would recommend using the something like this for the background of your images:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"
android:drawable="@drawable/button_selected"/>
<item android:drawable="@drawable/button_normal" />
</selector>
then toggle the images selected as you want and it should change the state based on the selector.
Upvotes: 1