在我的 Android 应用程序中,当用户按下列表中的某个项目时,该项目正确地以蓝色突出显示,但列表中的所有其他项目也以灰色突出显示。当用户抬起手指时,高光就会消失。这会导致整个列表出现不希望出现的“闪烁”效果。
如果我只从 ListView 中删除背景属性,闪烁效果就会消失。我正在寻找另一个修复程序,以便保留背景属性。
我使用的是安卓 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>