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.

Share:
12,823
Eno
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, 2022

Comments

  • Eno
    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
    Eno about 14 years
    Just wanted to add this in case someone else finds this thread. I used 'android:cacheColorHint="#00000000"' on the ListView layout to fix.
  • Romain Guy
    Romain Guy about 14 years
    That's a terrible idea, it makes scrolling/flinging the list a lot slower.
  • ubuntudroid
    ubuntudroid about 14 years
    Oh, good to know! For me it always worked well. Nevertheless, I will avoid this in the future and use the setCacheColorHint() solution... Thanks!