I have a RecyclerView with GridLayoutManager (lib v7 support). I am updating the adapter and doing notifyItemMoved. If the position of the source of the position is on the screen, and the destination is also displayed on the screen, the "move animation" is played. In case the element was located outside the screen (position 1000 or any other, located far from the viewport) and moved to the viewport, it will appear with "fade in animation".
Predictive element animations do not seem to work, although support is supported for predictiveItemAnimations () returns true. Am I doing something wrong? Do I have to override some methods to enable it?
I read the source code of RecyclerView, and in javadoc the dispatchLayout method is written as:
- PERSISTENT views are moved ({@link ItemAnimator # animateMove (ViewHolder, int, int, int, int)})
- Deleted views are deleted ({@link ItemAnimator # animateRemove (ViewHolder)})
- ADDED Additions Added ({@link ItemAnimator # animateAdd (ViewHolder)})
- DISAPPEARING views move off-screen.
- APPEARING views move on screen
However, ItemAnimator does not distinguish between ADDED and APPEARING. Is it possible to fix the prediction animation, or at least make the APPEARING animation look like “moving outside the screen animation”, leaving the ADDED animation as it is?
source
share