Únete a ⁠ #Android11: The Beta Launch Show el 3 de junio.

DefaultItemAnimator

open class DefaultItemAnimator : SimpleItemAnimator
kotlin.Any
   ↳ androidx.recyclerview.widget.RecyclerView.ItemAnimator
   ↳ androidx.recyclerview.widget.SimpleItemAnimator
   ↳ androidx.recyclerview.widget.DefaultItemAnimator

This implementation of RecyclerView.ItemAnimator provides basic animations on remove, add, and move events that happen to the items in a RecyclerView. RecyclerView uses a DefaultItemAnimator by default.

Summary

Inherited constants

Public constructors

This implementation of RecyclerView.ItemAnimator provides basic animations on remove, add, and move events that happen to the items in a RecyclerView.

Public methods

open Boolean

open Boolean
animateChange(oldHolder: RecyclerView.ViewHolder!, newHolder: RecyclerView.ViewHolder!, fromX: Int, fromY: Int, toX: Int, toY: Int)

open Boolean
animateMove(holder: RecyclerView.ViewHolder!, fromX: Int, fromY: Int, toX: Int, toY: Int)

open Boolean

open Boolean
canReuseUpdatedViewHolder(@NonNull viewHolder: RecyclerView.ViewHolder, @NonNull payloads: MutableList<Any!>)

When an item is changed, ItemAnimator can decide whether it wants to re-use the same ViewHolder for animations or RecyclerView should create a copy of the item and ItemAnimator will use both to run the animation (e.g. cross-fade).

open Unit

open Unit

open Boolean

open Unit

Inherited functions

Public constructors

<init>

DefaultItemAnimator()

This implementation of RecyclerView.ItemAnimator provides basic animations on remove, add, and move events that happen to the items in a RecyclerView. RecyclerView uses a DefaultItemAnimator by default.

Public methods

animateAdd

open fun animateAdd(holder: RecyclerView.ViewHolder!): Boolean

animateChange

open fun animateChange(
    oldHolder: RecyclerView.ViewHolder!,
    newHolder: RecyclerView.ViewHolder!,
    fromX: Int,
    fromY: Int,
    toX: Int,
    toY: Int
): Boolean

animateMove

open fun animateMove(
    holder: RecyclerView.ViewHolder!,
    fromX: Int,
    fromY: Int,
    toX: Int,
    toY: Int
): Boolean

animateRemove

open fun animateRemove(holder: RecyclerView.ViewHolder!): Boolean

canReuseUpdatedViewHolder

open fun canReuseUpdatedViewHolder(
    @NonNull viewHolder: RecyclerView.ViewHolder,
    @NonNull payloads: MutableList<Any!>
): Boolean

When an item is changed, ItemAnimator can decide whether it wants to re-use the same ViewHolder for animations or RecyclerView should create a copy of the item and ItemAnimator will use both to run the animation (e.g. cross-fade).

Note that this method will only be called if the ViewHolder still has the same type (Adapter#getItemViewType(int)). Otherwise, ItemAnimator will always receive both ViewHolders in the animateChange(ViewHolder, ViewHolder, ItemHolderInfo, ItemHolderInfo) method.

If the payload list is not empty, DefaultItemAnimator returns true. When this is the case:

Parameters
viewHolder RecyclerView.ViewHolder: The ViewHolder which represents the changed item's old content.
payloads MutableList<Any!>: A non-null list of merged payloads that were sent with change notifications. Can be empty if the adapter is invalidated via RecyclerView.Adapter#notifyDataSetChanged(). The same list of payloads will be passed into RecyclerView.Adapter#onBindViewHolder(ViewHolder, int, List) method if this method returns true.
Return
Boolean True if RecyclerView should just rebind to the same ViewHolder or false if RecyclerView should create a new ViewHolder and pass this ViewHolder to the ItemAnimator to animate. Default implementation calls canReuseUpdatedViewHolder(ViewHolder).

endAnimation

open fun endAnimation(item: RecyclerView.ViewHolder): Unit

endAnimations

open fun endAnimations(): Unit

isRunning

open fun isRunning(): Boolean

runPendingAnimations

open fun runPendingAnimations(): Unit