Ich versuche, colo für überprüft/ausgewählte Zeile nach Methode: listView.setItemChecked (i, true); aber auf Android 2.2.1 funktioniert nicht, Farbe wurde nicht geändert. Wenn ich state_activated verwende, dann ist dies nur für neuere Versionen. Wie kann ich das machen? Vielen Dank. Ich habe Selektor:Android-Selektor für ListView von setItemChecked funktioniert nicht in Version 2.2.1
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:drawable="@color/orange"/>
<item android:state_checked="false" android:drawable="@android:color/transparent"/>
Dann Listview:
<ListView
android:id="@+id/listMP3"
android:layout_width="match_parent"
android:layout_height="0dp"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:layout_weight="1"
android:clickable="true"
android:choiceMode="singleChoice">
</ListView>
RowView:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/list_item_selector"
android:id="@+id/playerRow" android:paddingTop="5dp" android:paddingBottom="5dp" >
<TextView
android:id="@+id/itemName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.72"
android:text="@string/songName" />
<TextView
android:id="@+id/itemLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/songLength" />
sind Sie sicher, dass Version 2.2.1 für Sie von Bedeutung ist? http://developer.android.com/intl/es/about/dashboards/index.html – Budius
Ja, es ist Archos 70 Tablette mit 2.2.1 Android – Musketyr