4

I'm having a strange issue. I need to implement swipe to delete in my listview. When user swipes left/right, I need to animate a delete button into/out of the screen and then on delete button click I need to delete that item from listview.

I am using Commonswares [TouchList] (https://github.com/commonsguy/cwac-touchlist/tree/master/src/com/commonsware/cwac/tlv) library to achieve that. In onFling method it gets the position of the swiped row and send it to onRemove method in my activity. I can delete the item accurately. But if i animate the row at swiped position, multiple rows get effected. I am not able to fix this issue nor am I able to find any help.

Any help will be appreciated.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
sam
  • 51
  • 2

1 Answers1

0

I had a similar issue to this which was down to Android's view recycling.

(A good explanation of it is available here)

To resolve I simply reset the animation in the item's OnResume method as I didn't need to retain the animation for the item which has scrolled out of view.

Community
  • 1
  • 1
Brian F
  • 1,620
  • 1
  • 19
  • 23