Ksenia
Ksenia

Reputation: 3753

Animation for removing item from recycleVIew

I have the RecyclerView, ItemTouchHelper and ItemTouchHelper.Callback instances to work together, and on swipe to left the selected item supposed to be removed (by this tutorial). The removal animation works, but only partly. First after swipe the item seems to be removed, but after that it reappers, and the list stays still the same:

enter image description here

Why can it happen?

Upvotes: 0

Views: 4289

Answers (1)

Suraj Vaishnav
Suraj Vaishnav

Reputation: 8305

Ensure these two statements

 cartList.remove(position);
        // notify the item removed by position
        // to perform recycler view delete animations
        // NOTE: don't call notifyDataSetChanged()
        notifyItemRemoved(position);

are executing.

Upvotes: 6

Related Questions