Open agrrwall opened 9 years ago
This is because SwipeItemMangerImpl
tracks item state using position in list instead of id. Position is just a visible location on screen, so when something gets deleted (and another item takes it's position), things get ugly.
Usage of stable ids (returned by adapter.getItemId(position)
) would solve this issue. You can read more about stables ids in this SO answer; it is about ListView, but same things apply to RecyclerView too.
Hope this helps. I also have a branch with fix, but it is against 1.1.8, and has few other changes.
+1 meet the same problem.
Same problem, it even brings back the deleted items. Please fix this @daimajia
@Alexander-- getItemId
did the trick! Thanks a lot.
Same problem.....
I've noticed some strange issues with Swiping to Delete elements. To make this easy, I've used the sample to show case my issue. If I swipe to delete an element, the element below stays in the delete state. Basically, it looks like the bottom layout stays over the next element.
Here's what happens in the sample: Original Load:
Swipe Left on Top Element (Alabama):
Notice that Alabama gets deleted, but Alaska (the element below) still has the bottom view open. I can't figure out how to prevent this behavior. To try out the code, simply replace the OnCreateViewHolder from the sample with the following (has some logging):
I noticed when I remove the notifyItemRangeChanged(...), the situation looks a little better, but it turns out random elements still look like Delete Item. Any thoughts/suggestions?
Edit: Ignore the multiple/single mode. Looks like this happens regardless :(