The add animation work nicely, there is cascading effect where the items arrives one by one.
However, the remove animation is clunky: all the items are removed at the same time. I would expect the items to be removed one by one as well.
After reading the source, I noticed that BaseItemAnimator uses ViewHolder.getOldPosition() to achieve the cascading effect for remove animations. But for me, the old position is always -1, meaning the RecyclerView is not recording ViewHolder's old position.
Are there any special setup you have to do to make RecyclerView record ViewHolder's old position?
Video: https://imgur.com/a/DoDWNvE
Hi, I'm using an animator like so:
The add animation work nicely, there is cascading effect where the items arrives one by one. However, the remove animation is clunky: all the items are removed at the same time. I would expect the items to be removed one by one as well.
After reading the source, I noticed that BaseItemAnimator uses
ViewHolder.getOldPosition()
to achieve the cascading effect for remove animations. But for me, the old position is always -1, meaning the RecyclerView is not recording ViewHolder's old position.Are there any special setup you have to do to make RecyclerView record ViewHolder's old position?