Romain Pellerin
Romain Pellerin

Reputation: 2480

Replace row of a listview with animation Android

Could you please suggest me ideas about how to animate the replacing of a row of a listview with animation after a 'long item click'. I'd like to do something like Twitter's app, when you 'long click' on a tweet. Thank you.

Upvotes: 0

Views: 372

Answers (1)

kvh
kvh

Reputation: 2158

First, your should get the item you want:

int visiblePosition = yourListView.getFirstVisiblePosition();
View v = yourListView.getChildAt(itemIndex - visiblePosition);

Second, start an animation on the item:

Animation anim = AnimationUtils.loadAnimation(
                 GoTransitApp.this, android.R.anim.slide_out_right
             );
anim.setDuration(500);
v.startAnimation(anim );

Hope this will help you!

Reference: Android – Update single item in ListView

animation

Upvotes: 1

Related Questions