BottomNavigatioView ColorStateList 不适用于 api <=26

BottomNavigatioView ColorStateList not work on api <=26

我已经将 bottomNavigationView 集成到我的应用程序中。我已经配置了一些 ColorStateList 来改变背景颜色。此选择器在 api <= 26

中被忽略

这是我的背景选择器:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="#B59339" android:drawable="@color/gold" android:state_checked="true" />
    <item android:color="#112620" android:drawable="@color/app_dark_color" android:state_checked="false" />
</selector>

这是我的 bottomNavigationView

app:itemIconTint="@color/bottom_nav_tint"
app:itemTextColor="@color/bottom_nav_tint"

我也尝试过使用可绘制对象,但它没有任何改变

app:itemIconTint="@drawable/bottom_nav_tint"
app:itemTextColor="@drawable/bottom_nav_tint"

我已经解决了。 我将 colorFilterList 文件移动到 drawable 中并这样称呼它:

app:itemBackground="@drawable/bottom_nav_background"
app:itemIconTint="@drawable/bottom_nav_tint"
app:itemTextColor="@drawable/bottom_nav_tint"