在底部导航中添加彩色图标可显示纯色图标

时间:2019-03-12 16:13:30

标签: android android-layout android-fragments bottomnavigationview

当选择项目时,我需要在底部导航中显示以下图像。

enter image description here

问题是,当我在底部导航中添加它时,它会像这样显示。

enter image description here

但是如果使用单色图像,则可以很好地加载。

这是我的代码。

 <com.app.myapp.utils.BottomNavigationViewEx
        android:id="@+id/navigation"
        android:layout_width="0dp"
        android:layout_height="50dp"
        android:background="@color/primary_color"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:labelVisibilityMode="labeled"
        android:fitsSystemWindows="true"
        app:menu="@menu/navigation"
        app:itemIconTint="@drawable/bottom_navigation_colors"
        app:itemTextColor="@drawable/bottom_navigation_colors"

        />

bottom_navigation_colors

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_checked="true"
        android:color="@color/tab_background_selected" />
    <item
        android:state_checked="false"
        android:color="@color/white40Opacity" />
</selector>

0 个答案:

没有答案
相关问题