Android ListView:drawSelectorOnTop在主题中被忽略?

Android ListView:drawSelectorOnTop在主题中被忽略?,android,listview,Android,Listview,在styles.xml中,我为ListView项目定义了一个主题和一个样式: // styles.xml <style name="MyTheme"> <item name="android:listViewStyle">@style/ListView</item> </style> <style name="ListView"> <item name="android:drawSelectorOnTop">

在styles.xml中,我为ListView项目定义了一个主题和一个样式:

// styles.xml
<style name="MyTheme">
    <item name="android:listViewStyle">@style/ListView</item>
</style>

<style name="ListView">
    <item name="android:drawSelectorOnTop">true</item>
    <item name="android:listSelector">@drawable/my_red_selector</item>
</style>
//styles.xml
@样式/列表视图
真的
@可抽出式/我的红色选择器
我使用的是ListFragment,我可以看到我的listview选择器的颜色是受尊重的(“drawable/my_red_selector”),但似乎drawSelectorOnTop属性被忽略了-我的选择器仍然在下面绘制

如果我定义自己的布局文件并执行以下操作:

<ListView
    android:id="@+id/foo"
    ...
    style="@style/ListView" />

然后,样式中的drawSelectorOnTop属性将被启用。是否有什么地方我可能做错了,导致我的顶部选择器属性被忽略

谢谢

----编辑---------

以下是“我的红色选择器”的定义:

//my\u red\u selector.xml
//red_on.xml

如果您有自定义行,请在ListView的列表项行上尝试以下选择器



在@drawable/my_red_选择器中,您是否试图更改焦点上的背景色?嗨,萨娜,嗯,可能是我在上面粘贴了选择器定义,可能这就是问题所在?您找到有效的解决方案了吗?我也有同样的问题。一个普通的listview它工作得很好,但是ListFragment不能像预期的那样工作。我的listview行也没有做任何有趣的事情,它们只是没有指定背景或类似背景的直线布局。你的listview是自定义listview还是标准ArrayAdapter?在一种情况下是自定义listview,在另一种情况下我使用ArrayAdapter。那么我们在这里处理两个listview吗?嗨,是的,我在整个项目中有一些列表视图,但它们在这两种配置中(自定义列表视图和arrayadapter列表视图)。
// my_red_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/red_on"/>
  <item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/red_on"/>
  <item android:state_focused="true" android:drawable="@drawable/red_on"/>
  <item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/transparent"/>
</selector>

// red_on.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
  <solid android:color="@color/red" />
</shape>
    <!-- Active tab -->
    <item android:drawable="@android:color/transparent" android:state_focused="false" android:state_pressed="false" android:state_selected="true"/>
    <!-- Inactive tab -->
    <item android:drawable="@android:color/transparent" android:state_focused="false" android:state_pressed="false" android:state_selected="false"/>
    <!-- Pressed tab -->
    <item android:drawable="@drawable/red_on" android:state_pressed="true"/>
    <!-- Selected tab (using d-pad) -->
    <item android:drawable="@drawable/red_on" android:state_focused="true" android:state_pressed="false" android:state_selected="true"/>

</selector>