我已經申請到ListView列表項的背景正在改變滾動
<style name="CKButtons">
<item name="android:windowBackground">@color/window_background</item>
</style>
背景顏色,但每次列表滾動的背景顏色更改回系統默認的(黑色)。滾動停止時,顏色會回到@color/window_background
。
風格在AndroidManifest.xml
應用:
<activity android:name=".event.EventList"
android:theme="@style/CKButtons"></activity>
和我的ListView看起來像這樣:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/android:list"/>
<TextView
android:id="@+id/android:empty"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="@string/eventlist_no_items"/>
</LinearLayout>
我怎樣才能防止這種情況發生?
我試圖讓我的佈局與樣式分開。有沒有辦法在'styles.xml'上應用colorCacheHint? – Mannaz 2010-03-10 11:15:40
明白了這一點:http://stackoverflow.com/questions/2416276/list-item-background-is-changing-on-scroll/2416388#2416388 – Mannaz 2010-03-10 11:29:20