如果大家在非黑色背景下使用ListView控件時,Android默認可能在滾動ListView時這個列表控件的背景突然變成黑色。這樣可能導致程序的黑色的背景和主程序的主題既不協調。解決的方法Google在設計Android時也考慮了,在Layout的ListView中加入android:cacheColorHint="#00000000" 的屬性即可。
如:
<?xml version="1.0" encoding="utf-8"?> <ListView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/comList" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/white" android:cacheColorHint="#00000000" > </ListView>