9
Duplicate:

Background ListView becomes black when scrolling

I have a listview within which each item contains black text on a white background. When testing on a Nexus One, when scrolling down to read through the text, a black highlight appears over the text and makes it unreadable.

I am trying to figure out what is this setting so I can turn it off. I do not want anything to get highlighted when scrolling down through the list. How can I accomplish this?

Thanks.

Community
  • 1
  • 1
JohnRock
  • 6,695
  • 12
  • 51
  • 61
  • 1
    possible duplicate of [Background ListView becomes black when scrolling](http://stackoverflow.com/questions/2833057/background-listview-becomes-black-when-scrolling) – David Snabel-Caunt Sep 28 '11 at 12:26

4 Answers4

14

You probably want to set the cacheColorHint to the same color as your background.

So, when you're defining your layout, just add android:cacheColorHint='#fff' to your ListView:

<ListView android:id="@+id/list"
    android:cacheColorHint="#fff"
    android:background="#fff"
    ...etc />
synic
  • 25,874
  • 18
  • 106
  • 144
7

This may be a trick:

android:cacheColorHint="@android:color/transparent" 
Paresh Mayani
  • 125,853
  • 70
  • 238
  • 294
1

Another solution would be to set the backgroundcolor of your list to transparent.

1

I had the same issue and setting the android:cacheColorHint to transparent seems to do the trick

Henok
  • 101
  • 1
  • 1