Friday, February 22, 2013

DevBytes: ListView Animations

How animating ListView items can lead to problems as views are recycled, and how to perform these types of animations correctly with new API added in Jellybean.

Code: http://developer.android.com/shareables/devbytes/ListViewAnimations.zip

YouTube: https://www.youtube.com/watch?v=8MIfSxgsHIs

4 comments:

hazam said...

Thank you Chet for the tip,
I see both solutions leverage pretty recent APIs - ViewPropertyAnimator and transientState (level 16).

Any tips how to do this on earlier API levels?
What's the flag that prevents Views from being recycled?
Thanks

Chris Arriola said...

Hi Chet,

Thanks for this tip. Using this same example, do you know of any way such that when an item disappears, instead of content from below filling out the empty spaces, the content from above will be used?

Thanks
Chris

Unknown said...

Thanks for this kind of animation,but how about touch one view and then drag it to the other place in the list and on dropping there it will produce animation like swapping between two different thing means dragged view take the place of dropped view place and vice versa.
Thanks

Anonymous said...

Chet, Nice article, Can you take a look at this question at StackOverflow? This is about animating the newly added listview item. http://stackoverflow.com/questions/17598057/why-listview-doesnt-animate-the-right-item