Reputation: 3753
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:
Why can it happen?
Upvotes: 0
Views: 4289
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