我想让我的应用程序在2.3中正常工作(它在4.0+中工作正常),我遇到的一个问题是在我的列表视图中我无法获得所选项目的背景将更改。我不知道我需要改变 - 有人知道吗?Android的listview选定的背景不起作用在2.3
这里的ListView控件本身:
<ListView
android:id="@+id/score_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/keyboard"
android:layout_below="@+id/sort_header"
android:choiceMode="singleChoice"
android:divider="#CCCCCC"
android:dividerHeight="1dp"
android:listSelector="@drawable/selector" />
下面是在4.0以上版本的工作选择(在2.3没有颜色变化):
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="@color/highlight"/>
<item android:state_pressed="true" android:drawable="@color/highlight"/>
<item android:state_activated="true" android:drawable="@color/highlight"/>
<item android:state_selected="true" android:drawable="@color/highlight"/>
</selector>
我其实并不需要的所有4那些,但我想尝试一切。
那么我可以在API级别9上做什么?该列表中没有任何内容用于突出显示所选项目。 – GrilledCheese 2013-04-03 22:29:33
我更新了我的答案。 – AwadKab 2013-04-03 23:20:38
当我点击,出现这种情况真的很快: 1.整个列表被高亮显示 2.项目我点击unhighlights 3.整个列表unhighlights 所以也没有突出的一个,我点击。如果我按住,整个列表将保持突出显示,直到我释放。 – GrilledCheese 2013-04-03 23:31:39