Bottom navigation icon colors are not displayed correctly
I have a problem with this BottomNavigationView library https://github.com/ittianyu/BottomNavigationViewEx
Colors specified in this XML file are not displayed correctly
color_state.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/black" android:state_checked="true" android:alpha="1"/>
<item android:color="#bdbdbd" android:state_checked="false" />
</selector>
As you can see, I set the color state_checked = true
to black, but instead it looks like this .
The same happens with state_checked = false
, Any body knows how I can solve this problem.
Here is the BottomNavigation code:
<com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx
android:layout_width="match_parent"
android:layout_height="60dp"
app:menu="@menu/navigation_view_menu"
app:itemIconTint="@drawable/color_state"
android:id="@+id/bottomnav"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:itemBackground="@android:color/transparent"
app:itemTextColor="@drawable/state"
android:background="@android:color/white"
>
</com.ittianyu.bottomnavigationviewex.BottomNavigationViewEx>
source to share
It was really stupid for me - after a few hours of debugging, learning about the differences between supplying @color and @drawable and the differences between the various states of the views, it turned out that I had both layout
and layout-v21
folders in my directory res
and I was just editing the first one.
source to share