android listview如何设置选中颜色
1个回答
展开全部
新建drawable/item_bk.xml
Xml代码
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false"
android:drawable="@color/trans" />
<item android:state_focused="true" android:drawable="@color/trans"></item>
<item android:state_pressed="true" android:drawable="@color/trans"></item>
</selector>
然后在listview里面加入:
Xml代码
android:listSelector="@drawable/item_bk"
Xml代码
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false"
android:drawable="@color/trans" />
<item android:state_focused="true" android:drawable="@color/trans"></item>
<item android:state_pressed="true" android:drawable="@color/trans"></item>
</selector>
然后在listview里面加入:
Xml代码
android:listSelector="@drawable/item_bk"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询