I try to add two colors to the default colors in the BottomNavigationView (for two states of menu items) and a third color. To do this, in the drawable folder, created the file "bottom_nav_colors.xml" with selectors:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked = "true" android:color = "@color/colorPrimaryDark"/> <item android:state_activated="true" android:color = "@color/colorAccent"/> <item android:color = "@color/colorGray" /> </selector > In the markup file "activity_main.xml" indicated as follows:
<android.support.design.widget.BottomNavigationView android:id="@+id/navigation" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:background="?android:attr/windowBackground" app:menu="@menu/navigation_menu" app:itemIconTint="@drawable/bottom_nav_colors" app:itemTextColor="@drawable/bottom_nav_colors"/> However, I cannot figure out which method of the class "BottomNavigationView" from the class "MainActivity.java" (inherits from the class "MvpAppCompatActivity") to activate the state "activated" (or any other from the list: "accelerated", "active" etc.).
Well, or if you can not do this, how can you?
