我有一个像这样的偏好屏幕:
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
>
<CheckBoxPreference
android:title = "Turn parrot on"
android:defaultValue="false"
android:enabled="true"
android:persistent="true"
android:key="turning parrot" />
<ListPreference
android:key = "interval"
android:title = "Talking interval"
android:persistent="true"
android:enabled="true"
android:entries="@array/updateInterval"
android:entryValues="@array/updateIntervalValues"
android:dependency="turning parrot"
android:defaultValue = "1"
/>
<ListPreference
android:key = "language"
android:title = "Talking language"
android:persistent="true"
android:enabled="true"
android:entries="@array/talkinglanguages"
android:entryValues="@array/talkinglanguagesValues"
android:dependency="turning parrot"
android:defaultValue = "1"
/>
</PreferenceScreen>
当我滚动首选项列表时,所有内容都会变为白色。如果我的列表是列表视图 我应该做以下
listView = (ListView) this.findViewById(R.id.listview);
listView.setCacheColorHint(Color.TRANSPARENT);
我从中学到了 here
但我的偏好列表没有id。如何在滚动时更改缓存颜色以消除白色。
答案 0 :(得分:1)
首选项屏幕由标准的ListView组成,并具有默认的Android ID list
。
ListView listView = (ListView)findViewById(android.R.id.list);
使用它来设置缓存颜色提示。