in Android Code Tips

Android ListView black background when scrolling problem

ListViews in Android as explained here uses Android’s black color as the default background. If you change this background the default behavior is for the ListView to cache the default color for optimazation.

To fix this issue, all you have to do is either disable the cache color hint optimization, if you use a non-solid color background, or set the hint to the appropriate solid color value. This can be dome from code or preferably from XML, by using the android:cacheColorHint attribute. To disable the optimization, simply use the transparent color #00000000.

example:

<ListView android:id="@android:id/list" android:layout_width="fill_parent"
		android:layout_height="fill_parent" android:layout_weight="1"
		android:layout_gravity="top" android:cacheColorHint="#00000000">
Share