默认样式:
修改效果(我这里只将默认的深紫色改成了蓝色):
第一种方法,利用Drawable来实现:
app:itemIconTint="@drawable/footstyle"
app:itemTextColor="@drawable/footstyle"
footstyle.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#0000FF" android:state_checked="true" />
<item android:color="#696969" android:state_checked="false"/>
</selector>
第二种方法,利用theme来实现:
android:theme="@style/footButton"
<!-- 底部导航栏按钮theme. -->
<style name="footButton" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@color/colorBlue</item>
<item name="android:textColorSecondary">@color/colorDarkGrey</item>
</style>
赠人玫瑰,手有余香
假如看完文章对您有帮助,那就点个赞吧。