android – When using clipToPadding in ListView's the items get recycled prematurely-ThrowExceptions

Exception or error:

when setting


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?

How to solve:

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 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *