自定义ListView的Item项在pressed或selected等状态时的颜色

在此Item项布局文件中添加android:background="@drawable/list_selector"


********list_selector.xml********

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/list_selector_background_focus" />
    <item android:state_selected="true" android:drawable="@drawable/list_selector_background_focus" />
    <item android:state_focused="true" android:drawable="@drawable/list_selector_background_focus" />
    <!-- default drawable -->
    <item android:drawable="@drawable/list_selector_background" />
</selector>



你可能感兴趣的:(android,ListView,list,encoding)