I have use the material bottom nav to add badge to its view, and I also able to change color by assigning simple color, but when I want to set that color based on selected state, the color doesn't change. same for badge text color, it doesn't change when I use selector color.
here is the code snippet:
val badge = bottomNavigation.getOrCreateBadge(R.id.cartIcon)
badge.backgroundColor = getColor(R.color.badge_color_selector)
in my badge_color_selector.xml:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/error_state" android:state_selected="false" />
<item android:color="@color/white" android:state_selected="true" />
</selector>