animateDisappearance
Called by the RecyclerView when a ViewHolder has disappeared from the layout.
This means that the View was a child of the LayoutManager when layout started but has been removed by the LayoutManager. It might have been removed from the adapter or simply become invisible due to other factors. You can distinguish these two cases by checking the change flags that were passed to recordPreLayoutInformation.
Note that when a ViewHolder both changes and disappears in the same layout pass, the animation callback method which will be called by the RecyclerView depends on the ItemAnimator's decision whether to re-use the same ViewHolder or not, and also the LayoutManager's decision whether to layout the changed version of a disappearing ViewHolder or not. RecyclerView will call animateChange instead of animateDisappearance
if and only if the ItemAnimator returns false
from canReuseUpdatedViewHolder and the LayoutManager lays out a new disappearing view that holds the updated information. Built-in LayoutManagers try to avoid laying out updated versions of disappearing views.
If LayoutManager supports predictive animations, it might provide a target disappear location for the View by laying it out in that location. When that happens, RecyclerView will call recordPostLayoutInformation and the response of that call will be passed to this method as the postLayoutInfo
.
ItemAnimator must call dispatchAnimationFinished when the animation is complete (or instantly call dispatchAnimationFinished if it decides not to animate the view).
Return
true if a later call to runPendingAnimations is requested, false otherwise.
Parameters
The ViewHolder which should be animated
The information that was returned from recordPreLayoutInformation.
The information that was returned from recordPostLayoutInformation. Might be null if the LayoutManager did not layout the item.