Android:ListView选择器无法正常工作

Roh*_*han 3 android listview

我正在尝试将选择器应用到我的列表视图,它是一个自定义列表视图,我尝试了很多选项,但没有任何工作.任何帮助将不胜感激.我附上了我的代码.提前致谢

selector_listview.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/faintblue" />
    <item android:state_focused="true" android:drawable="@drawable/yellow" />

</selector>
Run Code Online (Sandbox Code Playgroud)

layout_listview.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff" >

    <ListView
        android:id="@+id/lvChatList"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/rlHeader"
        android:background="@drawable/selector_expandable_listview"
        android:listSelector="@drawable/selector_expandable_listview" >

    </ListView>

    <TextView
        android:id="@+id/tvNoChats"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="No Chats"
        android:visibility="gone" />

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

黄色背景效果有效发生但蓝色效果没有发生,请提前帮助谢谢

vip*_*tal 20

将此选择器设置为每行的背景而不是listview.