In My Bottom navigation bar, I am using an icon in the menu XML, the icon color changed with the theme color when selected.
after the tab click the icon totally change I am totally stuck why this happens with the png image.
Bottom navigation
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white"
app:labelVisibilityMode="labeled"
app:itemBackground="@color/transparent"
app:itemTextColor="@color/black"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="@menu/bottom_navigation_main" />
Selector
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_compas"
android:state_checked="false"/>
<item android:drawable="@drawable/discover_green"
android:state_enabled="true"/>
</selector>
Bottom_nav_menu
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/chatMenuFragment"
android:enabled="true"enter code here
android:icon="@drawable/chat_selector"
android:title="Chat"
app:showAsAction="always" />
<item
android:id="@+id/contactsFragment"
android:enabled="true"
android:icon="@drawable/people_selector"
android:title="People"
app:showAsAction="always" />
<item
android:id="@+id/discoverFragment"
android:enabled="true"
android:icon="@drawable/discover_selector"
android:title="Discovery"
android:backgroundTint="@color/white"
app:showAsAction="always|withText" />
<item
android:id="@+id/myProfileFragment"
android:enabled="true"
android:icon="@drawable/user_selector"
android:title="My"
app:showAsAction="always|withText" />
</menu>
screenshots
Before selection:
After selection:
discover_green
drawable? – Torchwood