(Android)listview分隔符已删除,但单击后仍显示蓝线

(Android)listview分隔符已删除,但单击后仍显示蓝线,android,listview,layout,Android,Listview,Layout,我在LinearLayout中有一个listview,我删除了它在xml中的分隔符,如下所示: <LinearLayout android:layout_width="match_parent" android:layout_height="140dp" android:orientation="vertical" android:background="@drawable/main_content">

我在LinearLayout中有一个listview,我删除了它在xml中的分隔符,如下所示:

   <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="140dp"
        android:orientation="vertical"
        android:background="@drawable/main_content">
        <ListView 
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:cacheColorHint="@null"
            android:divider="@null"
            android:dividerHeight="0dp"/>
     </LinearLayout>

问题是,每次我单击一个项目时,项目上方会显示一条蓝线,就像存在分隔符一样。然后如果我点击其他地方,线路就会消失。如何阻止这种情况发生?

使用列表选择器属性,如下所示:

android:listSelector="#00000000"

您也可以将其设置为null。我已将其设置为透明。

在listview中添加这两行

android:drawSelectorOnTop="false"
android:listSelector="@android:color/transparent"
删除

android:cacheColorHint="@null"
android:divider="@null"
android:dividerHeight="0dp"
使用
我发现我只需要将它添加到我的xml中并将其设置为透明。设置为null不起作用。谢谢你的回答。看来将listSelector设置为透明是关键。没有此选项的所有其他设置都不起作用。谢谢大家的帮助。
<ListView 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false"
android:listSelector="@android:color/transparent"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"/>