Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using clipToPadding in ListView's the items get recycled prematurely

when setting

android:clipToPadding="false"

in a standard ListView on a 2.3.3 android device I am seeing that the list items are being recycled prematurely. The adapter's view is being removed when it is fully scrolled past the padding versus being scrolled past the edge of the screen resulting in views being removed too early. Has anyone been able to solve this issue?

like image 870
Maurycy Avatar asked Apr 10 '13 01:04

Maurycy


1 Answers

Clip to padding is the default behavior. Having the view recycled as soon as it's not visible (i.e. past the padding) is the normal and expected behavior.

Are you sure you're not trying to set clipToPadding to false? In that case, ListView will still recycle its children as soon as they enter the padding area. The attribute clipToPadding only affects drawing and is not taken into account by layout algorithms such as ListView's. We could fix this behavior in a future version of the platform but that won't help you right now, sorry :(

like image 63
Romain Guy Avatar answered Sep 18 '22 11:09

Romain Guy