I implemented RecyclerViewwhere I can add and remove elements. I want the added element to be added to the second last position, and when I add a new element, the animation works well. That is, the last element moves down, allowing the space for the new element to disappear.
When I delete an item, a problem arises that I do not know how to fix. How I want him to behave:
- the deleted item disappears
- move up all objects under it.
Actually, what happens is that, firstly, the last element disappears, and then the rest of the animation happens. When the items below the deleted item move up, the last item reappears as coming from behind a wall.
It seems to me that it RecyclerViewis compressed to the height of the "post-animation", and then the animation is performed.
I have not defined ItemAnimator, so it DefaultItemAnimatorshould be the one that was used. I watched this video and redefined the method supportsPredictiveItemAnimationsin the user implementation LinearLayoutManager, but it did not fix it.
source
share