Well, I wanted to understand how to make each element have its own image, and with some confusion in the comments about where it should go, I wanted to print this answer.
First create your menu and its items. Your selector will go into these elements in the ICON value. Here we have 2 selectors, each of which is made for its own menu item.
item android:id="@+id/navigation_home" android:icon="@drawable/navigation_home_selector" android:title="@string/title_home" /> item android:id="@+id/navigation_profile" android:icon="@drawable/navigation_profile_selector" android:title="@string/title_profile" />
Now here is your selector file, which will be placed in your drawing folder.
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/menu_selected" android:state_checked="true"/> <item android:drawable="@drawable/menu" android:state_checked="false"/> </selector>
Last step was provided by @ KishanSolanki124
Add this line of code to the BottomNavigationView.
BottomNavigationView.setItemIconTintList(null);
There you have it. Everything works like a charm.
A. Petrizza
source share