android所有BottomNavigationView项目都有相同的颜色

时间:2018-04-11 13:10:49

标签: android android-layout android-fragments material-design

下面是我的BottomNavigationView代码:

    <android.support.design.widget.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginEnd="0dp"
    android:layout_marginStart="0dp"
    android:background="#291D1E"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    android:currentTab=""
    app:itemIconTint="@drawable/nav_item_background"
    app:itemTextColor="@drawable/nav_item_background"
    app:menu="@menu/navigation" />

我的colortate drawable:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
   <item  android:color="#FF4D14" android:state_checked="true" />
   <item android:color="#532322" />
</selector>

但我得到以下输出:

SCREENSHOT Screenshot

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

修改Color_State_Drawable.xml并修改此行: -

<Item android:color="#532322" />

<item android:color="#532322" android_state_checked="false" />