My ListView backgrounds go black during scrolling - how to fix?
12,823
Solution 1
You will need to use the setCacheColorHint()
method of ListView.
Example: list.setCacheColorHint(yourBackColor);
Explanation of the issue and solution here
Solution 2
ScrollingCache="false" in your activity's *.xml file for the list object should do the trick, too.
![Eno](https://i.stack.imgur.com/ZOOgB.jpg?s=256&g=1)
Author by
Eno
Experienced mobile / web developer and systems admin (Linux, Solaris). Ive been using Linux since 1992 (anyone remember the SLS distro? But I still love my ole Beeb ;-)
Updated on June 08, 2022Comments
-
Eno about 2 years
Ive specified white backgrounds for pretty much all widgets and it works, except when scrolling. The background container goes black during scrolling resulting in annoying flickering.
-
Eno about 14 yearsJust wanted to add this in case someone else finds this thread. I used 'android:cacheColorHint="#00000000"' on the ListView layout to fix.
-
Romain Guy about 14 yearsThat's a terrible idea, it makes scrolling/flinging the list a lot slower.
-
ubuntudroid about 14 yearsOh, good to know! For me it always worked well. Nevertheless, I will avoid this in the future and use the setCacheColorHint() solution... Thanks!