我想要做的是这样的自定义彩色图像, 我试过制作这样的图层列表
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/ic_home"
android:bottom="20dp"
>
</item>
<item
android:top="20dp"
android:drawable="@drawable/ic_bottom_nav_selected_indicator"
android:gravity="center_vertical|center_horizontal">
</item>
但是它将显示白色而不是橙色和白色
然后我创建了一个包含两个项目的图像,并且该图像显示为白色!!!!
别忘了我是这样添加选择器的。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@drawable/img_selected_home"/>
<item android:state_pressed="true" android:state_enabled="true"
android:drawable="@drawable/img_selected_home"/>
<item android:drawable="@drawable/ic_home"/>
</selector>