Item dropped not getting initial state back

  android, itemtouchhelper

I am using object : ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.UP)

to swipe a horizontal RecyclerView up (there is only one item in the list per screen width)

in theory, user drags the view partially up, and it does something.
Up until here everything is fine.

However, if the user drops the view instead of dragging it back down, the next time he tries to drag it back up, the view jumps up to the height of the view.

After a lot of investigations i have noticed that clearView(RecyclerView, ViewHolder) is not called in case the item is dropped. And when I start dragging it again it is called twice when i drag it all the way down.

So I tried to call super.clearView manually, and it does not fix the problem.

Very important:
I do not do any height/width/translation manipulation on the view. I am trying to have the system do it.

How do I fix the item jump?

Source: Android Questions

LEAVE A COMMENT