在我的Android應用程序,當用戶按下我的列表中的項目,該項目正確地得到強調藍色高亮顯示的所有項目,但所有的其他項目該列表也會突出顯示爲灰色。當用戶擡起手指時,高光會消失。這會導致整個列表上的「閃爍」效應不受歡迎。
如果我只從ListView中刪除背景屬性,閃爍效果就會消失。我正在尋找另一個修復程序,以便我可以保留背景屬性。
我使用Android的17
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="8dip"
android:paddingTop="0dip"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:textColor="@color/my_sky"
android:background="@drawable/my_btn_white"
android:id="@+id/my_list"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
<Button
style="@style/MY.Flow.Button"
android:id="@+id/my_add_choices"
android:text="@string/my_favorites_add_choices"
android:layout_marginTop="10dip"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
我嘗試了android:listSelector =「@ android:color/transparent」和 android:cacheColorHint =「#00000000」,因爲那些在其他線程中被建議,但無濟於事。 – Kris