avatsav
avatsav

Reputation: 1248

cacheColorHint causing laggy scroll in listView

I am having this strange issue with listView and cacheColorHint..

I have the background of the activity set to a gradient..

When I set the android:cacheColorHint="#00000000" the scrolling becomes laggy, else it is super smooth.

I also tried programatically setting it...same laggy scrolling(dumb thing to think that it'd work )

When I don't set it...I have the flickering when I scroll that is why I set the cacheHintColor in the first place.....

It is the same problem as seen in this question although it seems it hasn't been solved..

ListView with getView() Over-Ridden Slow Due To Constant GC?

I've seen many applications which have smooth scrolling in-spite of having all sorts of backgrounds...so pease suggest a workaround or a fix please...

Additional details: App is a twitter client uses lists in a ListFragment. Each list item contains an image loaded from twitter...I'm using an opensource image loader class which works well(cant quite remember which one)...but since scrolling works well if cacheHintColor not set..hence I can rule out that the problem is with the image caching...

Upvotes: 2

Views: 1236

Answers (1)

nmr
nmr

Reputation: 16849

Perhaps it's slow because you're setting a transparent cache color hint which is forcing alpha compositing during scrolling. If your background is a solid color try setting a hint with full alpha, e.g. 0xff000000

Also, I imagine turning on scrollingCache will cache the overscrolled parts of the ListView, which would mean less drawing has to be done, but at the expense of more memory usage.

Upvotes: 2

Related Questions