List Background not Transparent when Scrolling
2010-07-18 13:43:32
It's the second time I bumped into this issue now. This time it was a preference screen, so I didn't realize it was the same problem as with a ListView in general. The short story is: if you want a ListView with a transparent background you need to add either:
android:cacheColorHint="#0000"
in the xml-declaration of it, or something like:
ListView v = getListView();
v.setCacheColorHint(0);
in code somewhere. If you're dealing with a preference activity, as was the case for me this time, then you can add the latter in your onCreate after inflating the preferences from xml.
If you don't do this, the list background will turn black (or whatever default is given by the theme used) during scrolling.
If you want to know more, here is the full story on list backgrounds
Posted by android 2
0 CommentsPage 1