是否可以让库中的所有项目都是"实心"的,没有透明度?我尝试过使用StateListDrawable,但它仍然为未选择的项提供了透明度。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/card_background" android:state_focused="true"/>
<item android:drawable="@color/card_background" android:state_pressed="true"/>
<item android:drawable="@color/card_background" android:state_active="true"/>
<item android:drawable="@color/card_background" android:state_selected="true"/>
<item android:drawable="@color/card_background" android:state_enabled="true"/>
<item android:drawable="@color/card_background" android:state_window_focused="true"/>
<item android:drawable="@color/card_background" android:state_focused="false"/>
<item android:drawable="@color/card_background" android:state_pressed="false"/>
<item android:drawable="@color/card_background" android:state_active="false"/>
<item android:drawable="@color/card_background" android:state_selected="false"/>
<item android:drawable="@color/card_background" android:state_enabled="false"/>
<item android:drawable="@color/card_background" android:state_window_focused="false"/>
<item android:drawable="@color/card_background"/>
</selector>
我在库xml 上用android:unselectedAlpha="1"
解决了这个问题