Friday, June 21, 2013

DevBytes: Animating ListView Deletion: Now on Gingerbread!

In this episode, I tried to anticipate the question I knew would come up on my previous show about animating ListView deletion: "But how would I do this on Gingerbread?"

Here's how.

YouTube: https://www.youtube.com/watch?v=PeuVuoa13S8&list=PLWz5rJ2EKKc_XOgcRukSoKKjewFJZrKV0&index=1

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

10 comments:

p.l said...

The one thing you forget to mention: in old animation system view event box does not get translated, so theoretically if the user press the gap during animation, he will select the item that is not in that place yet.

terry benidict said...
This comment has been removed by the author.
terry benidict said...

Hasse , i am facing issue with this demo , i have tried my custom list items to remove , but it seems when list view dont have much items to load as compare to screen height then the demo making strange behavior, please check this video
Video

Ryan Hoo said...

Hi~ The method setOnItemClick of the ListView is not woking here.

terry benidict said...

@Ryan Hoo: try mListView.setOnItemSelectedListener(listener)

Ryan Hoo said...

@terry benidict: Are you sure this little trick is woking?

Michele Saccomanno said...

me too... setOnItemSelectedListener don't work!!
@Ryan Hoo: do you solve the problem?

Anonymous said...

Hi, running on the emulator in eclipse using 3.2 HoneyComb right after the swipe the app crashes and in logcat shows: java.lang.NoSuchFieldError: android.view.View.TRANSLATION_Y. Strange, so the check with isRuntimePostGingerbread() correctly thinks it's post GingerBread (13), but my emulated android version doesn't have it... Checked in the docs, that field is only there since 14! So I guess the method isRuntimePostGingerbread() needs to change to checking for ICE_CREAM_SANDWiCH....

ccko said...

if sCheeseString
only has 10 or less items.

when remove one item, the listview will stuck.

any ideas?

thanks

Anonymous said...

How do you do it in Kit Kat?