に変更すると、タブごとに状態の色を変えることはできますか? BottomNavigation
にセレクタを追加してBottomNavigation
state_checked
の色を変更することができます。Android - `BottomNavigationView`の` state_checked`色を
私が必要とするのは、各タブのstate_checked
の色を変更することです。 私は上の最初のアイコンをクリックすると、私のBottomNavigation
私は...など赤に2番目のアイコンを変更色に、緑に
BottomNavigationView
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_gravity="bottom"
app:itemIconTint="@drawable/selector"
app:itemTextColor="@drawable/selector"
android:background="?android:attr/windowBackground"
app:menu="@menu/navigation" />
selector.xml
<?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/green" />
<item android:color="@android:color/darker_gray" />
</selector>
をアイコン
state_checked
色を変更する必要があります
今度はstate_checked
の色は緑で、デフォルトの色はグレーです。