VansFannel
VansFannel

Reputation: 45921

How to disable this behaviour on a ListView

I'm developing an Android 2.2 application with a ListView.

I want to disable this:

I have a ListView with three list items. When I press over the first list and, without releasing, I move down through second item and third item. Then, when my finger is over the third item I release it. After that I see that all of them has a black background.

How can I disable this effect?

If you need more details, please tell me.

Upvotes: 0

Views: 118

Answers (2)

Udinic
Udinic

Reputation: 3064

Use

android:cacheColorHint="#00000000"

as one of the ListView attributes. This will disable the color caching, which will stop doing this black thing.

Upvotes: 0

Todd Davies
Todd Davies

Reputation: 5522

Use this in your ListView element inside your XML file:

android:cacheColorHint="@android:color/transparent"

However, if your app has a background that is a solid color, then set the cacheColorHint to that color, as having it set to transparent can lead to slow scrolling. For example, if I had a green background:

android:cacheColorHint="#0F0"

Upvotes: 1

Related Questions