首页 > 解决方案 > BottomNavigation 视图中的波纹效果

问题描述

在我的 BottomNavigationView 中,我想添加波纹效果,然后更改我选择的导航项的背景颜色。这是我到目前为止所做的截图在此处输入图像描述

我的可绘制文件

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/colorAccent" android:state_checked="true"/>
    <item android:drawable="@color/colorPrimaryDark" android:state_checked="false"/>
</selector>

我的布局文件

<android.support.design.widget.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    app:itemBackground="@drawable/navigaton_item_bg"
    app:itemIconTint="@android:color/white"
    app:itemTextColor="@android:color/white"
    app:menu="@menu/navigation" />

标签: androidnavigationbottomnavigationview

解决方案


推荐阅读