要通过布局XML更改Android ListView中选定项(单击项)的背景色吗

要通过布局XML更改Android ListView中选定项(单击项)的背景色吗,android,listview,background,Android,Listview,Background,我想更改Android应用程序中单击的ListView项目的背景色(不想使用ClickOnListener实现)。我正在添加布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_

我想更改Android应用程序中单击的ListView项目的背景色(不想使用ClickOnListener实现)。我正在添加布局

  <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:minHeight="48dp"
    android:paddingLeft="10dp"
   >

<TextView
        android:id="@+id/tv_item"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:textColor="@color/black"
        android:textSize="@dimen/homeButtonTextSize"
        android:layout_gravity="center_vertical"
     ></TextView>
</LinearLayout>

我使用了一些选择器。但无法生成所需的输出。也尝试使用“android:activatedBackgroundIndicator”。但不起作用。请帮帮我


提前感谢

使用ListView上的属性并指向一个
可绘制的。另外,您不应该为每一行使用OnCLickListener,而是使用一个(with

是的,我使用的是OnItemClickListener()。这不是问题。我尝试了“android:listSelector”。它不起作用。那么drawable可能有问题,因为
listSelector
属性肯定有效。我添加了一行-“android:listSelector=“@drawable/background\u color”在给定xml的文本视图中。还在color.xml中添加了“#FF0000”。但没有任何用处。有什么建议吗?有趣的是,android版本4.3您没有使用
drawable。