# RecyclerView.ItemAnimator

Artifact: [androidx.recyclerview:recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview) [View Source](https://cs.android.com/search?q=file:androidx/recyclerview/widget/RecyclerView.java+class:androidx.recyclerview.widget.RecyclerView.ItemAnimator) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

*** ** * ** ***


```
public abstract class RecyclerView.ItemAnimator
```

<br />

Known direct subclasses [SimpleItemAnimator](https://developer.android.com/reference/androidx/recyclerview/widget/SimpleItemAnimator)

|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/SimpleItemAnimator` | A wrapper class for ItemAnimator that records View bounds and decides whether it should run move, change, add or remove animations. |

Known indirect subclasses [DefaultItemAnimator](https://developer.android.com/reference/androidx/recyclerview/widget/DefaultItemAnimator)

|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/DefaultItemAnimator` | This implementation of `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator` provides basic animations on remove, add, and move events that happen to the items in a RecyclerView. |

*** ** * ** ***

This class defines the animations that take place on items as changes are made to the adapter. Subclasses of ItemAnimator can be used to implement custom animations for actions on ViewHolder items. The RecyclerView will manage retaining these items while they are being animated, but implementors must call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` when a ViewHolder's animation is finished. In other words, there must be a matching `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` call for each `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)``https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animatePersistence(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, and `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` call.

By default, RecyclerView uses `https://developer.android.com/reference/androidx/recyclerview/widget/DefaultItemAnimator`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView#setItemAnimator(androidx.recyclerview.widget.RecyclerView.ItemAnimator)` |   |

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/annotation/IntDef(flag = true, value = ) @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) public annotation https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.AdapterChanges` The set of flags that might be passed to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. |
| `public interface https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemAnimatorFinishedListener` This interface is used to inform listeners when all pending or running animations in an ItemAnimator are finished. |
| `public class https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` A simple data structure that holds information about an item's bounds. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#FLAG_APPEARED_IN_PRE_LAYOUT() = 4096` This ViewHolder was not laid out but has been added to the layout in pre-layout state by the `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutManager`. |
| `static final int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#FLAG_CHANGED() = 2` The Item represented by this ViewHolder is updated. |
| `static final int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#FLAG_INVALIDATED() = 4` Adapter `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` has been called and the content represented by this ViewHolder is invalid. |
| `static final int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#FLAG_MOVED() = 2048` The position of the Item represented by this ViewHolder has been changed. |
| `static final int` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#FLAG_REMOVED() = 8` The Item represented by this ViewHolder is removed from the adapter. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#ItemAnimator()()` |

| ### Public methods |
|---|---|
| `abstract boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo )` Called by the RecyclerView when a ViewHolder is added to the layout. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder oldHolder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder newHolder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo )` Called by the RecyclerView when an adapter item is present both before and after the layout and RecyclerView has received a `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int)` call for it. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo )` Called by the RecyclerView when a ViewHolder has disappeared from the layout. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animatePersistence(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo )` Called by the RecyclerView when a ViewHolder is present in both before and after the layout and RecyclerView has not received a `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int)` call for it or a `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` call. |
| `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder)` 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). |
| `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder,java.util.List<java.lang.Object>)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/Object.html> payloads )` 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). |
| `final void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder)` Method to be called by subclasses when an animation is finished. |
| `final void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationStarted(androidx.recyclerview.widget.RecyclerView.ViewHolder)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder)` Method to be called by subclasses when an animation is started. |
| `final void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationsFinished()()` This method should be called by ItemAnimator implementations to notify any listeners that all pending and active item animations are finished. |
| `abstract void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#endAnimation(androidx.recyclerview.widget.RecyclerView.ViewHolder)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder item)` Method called when an animation on a view should be ended immediately. |
| `abstract void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#endAnimations()()` Method called when all item animations should be ended immediately. |
| `long` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#getAddDuration()()` Gets the current duration for which all add animations will run. |
| `long` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#getChangeDuration()()` Gets the current duration for which all change animations will run. |
| `long` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#getMoveDuration()()` Gets the current duration for which all move animations will run. |
| `long` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#getRemoveDuration()()` Gets the current duration for which all remove animations will run. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#isRunning()()` Method which returns whether there are any item animations currently running. |
| `final boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#isRunning(androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemAnimatorFinishedListener)( @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemAnimatorFinishedListener listener )` Like `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#isRunning()`, this method returns whether there are any item animations currently running. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#obtainHolderInfo()()` Returns a new `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` which will be used to store information about the ViewHolder. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#onAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder)` Called after `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` is called by the ItemAnimator. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#onAnimationStarted(androidx.recyclerview.widget.RecyclerView.ViewHolder)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder)` Called when a new animation is started on the given ViewHolder. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPostLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.State state, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder )` Called by the RecyclerView after the layout is complete. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.State state, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder, @https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.AdapterChanges int changeFlags, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/Object.html> payloads )` Called by the RecyclerView before the layout begins. |
| `abstract void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#runPendingAnimations()()` Called when there are pending animations waiting to be started. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#setAddDuration(long)(long addDuration)` Sets the duration for which all add animations will run. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#setChangeDuration(long)(long changeDuration)` Sets the duration for which all change animations will run. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#setMoveDuration(long)(long moveDuration)` Sets the duration for which all move animations will run. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#setRemoveDuration(long)(long removeDuration)` Sets the duration for which all remove animations will run. |

## Constants

### FLAG_APPEARED_IN_PRE_LAYOUT

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public static final int FLAG_APPEARED_IN_PRE_LAYOUT = 4096
```

This ViewHolder was not laid out but has been added to the layout in pre-layout state by the `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.LayoutManager`. This means that the item was already in the Adapter but invisible and it may become visible in the post layout phase. LayoutManagers may prefer to add new items in pre-layout to specify their virtual location when they are invisible (e.g. to specify the item should *animate in* from below the visible area).

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)` |   |

### FLAG_CHANGED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public static final int FLAG_CHANGED = 2
```

The Item represented by this ViewHolder is updated.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)` |   |

### FLAG_INVALIDATED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public static final int FLAG_INVALIDATED = 4
```

Adapter `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` has been called and the content represented by this ViewHolder is invalid.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)` |   |

### FLAG_MOVED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public static final int FLAG_MOVED = 2048
```

The position of the Item represented by this ViewHolder has been changed. This flag is not bound to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemMoved(int,int)`. It might be set in response to any adapter change that may have a side effect on this item. (e.g. The item before this one has been removed from the Adapter).

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)` |   |

### FLAG_REMOVED

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public static final int FLAG_REMOVED = 8
```

The Item represented by this ViewHolder is removed from the adapter.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)` |   |

## Public constructors

### ItemAnimator

Added in 1.0.0

```
public ItemAnimator()
```

## Public methods

### animateAppearance

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract boolean animateAppearance(
    @NonNull RecyclerView.ViewHolder viewHolder,
    @Nullable RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo,
    @NonNull RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo
)
```

Called by the RecyclerView when a ViewHolder is added to the layout.

In detail, this means that the ViewHolder was **not** a child when the layout started but has been added by the LayoutManager. It might be newly added to the adapter or simply become visible due to other factors.

ItemAnimator must call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` when the animation is complete (or instantly call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` if it decides not to animate the view).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder which should be animated |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. Might be null if Item was just added to the adapter or LayoutManager does not support predictive animations or it could not predict that this ViewHolder will become visible. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. |

| Returns |
|---|---|
| `boolean` | true if a later call to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#runPendingAnimations()` is requested, false otherwise. |

### animateChange

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract boolean animateChange(
    @NonNull RecyclerView.ViewHolder oldHolder,
    @NonNull RecyclerView.ViewHolder newHolder,
    @NonNull RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo,
    @NonNull RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo
)
```

Called by the RecyclerView when an adapter item is present both before and after the layout and RecyclerView has received a `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int)` call for it. This method may also be called when `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` is called and adapter has stable ids so that RecyclerView could still rebind views to the same ViewHolders. If viewType changes when `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` is called, this method **will not** be called, instead, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` will be called for the new ViewHolder and the old one will be recycled.

If this method is called due to a `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` call, there is a good possibility that item contents didn't really change but it is rebound from the adapter. `https://developer.android.com/reference/androidx/recyclerview/widget/DefaultItemAnimator` will skip animating the View if its location on the screen didn't change and your animator should handle this case as well and avoid creating unnecessary animations.

When an item is updated, ItemAnimator has a chance to ask RecyclerView to keep the previous presentation of the item as-is and supply a new ViewHolder for the updated presentation (see: `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder,java.util.List<java.lang.Object>)`. This is useful if you don't know the contents of the Item and would like to cross-fade the old and the new one (`https://developer.android.com/reference/androidx/recyclerview/widget/DefaultItemAnimator` uses this technique).

When you are writing a custom item animator for your layout, it might be more performant and elegant to re-use the same ViewHolder and animate the content changes manually.

When `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int)` is called, the Item's view type may change. If the Item's view type has changed or ItemAnimator returned `false` for this ViewHolder when `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder,java.util.List<java.lang.Object>)` was called, the `oldHolder` and `newHolder` will be different ViewHolder instances which represent the same Item. In that case, only the new ViewHolder is visible to the LayoutManager but RecyclerView keeps old ViewHolder attached for animations.

ItemAnimator must call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` for each distinct ViewHolder when their animation is complete (or instantly call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` if it decides not to animate the view).

If oldHolder and newHolder are the same instance, you should call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)`**only once**.

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 `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` if and only if the ItemAnimator returns `false` from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder)` 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.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder oldHolder` | The ViewHolder before the layout is started, might be the same instance with newHolder. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder newHolder` | The ViewHolder after the layout is finished, might be the same instance with oldHolder. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. |

| Returns |
|---|---|
| `boolean` | true if a later call to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#runPendingAnimations()` is requested, false otherwise. |

### animateDisappearance

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract boolean animateDisappearance(
    @NonNull RecyclerView.ViewHolder viewHolder,
    @NonNull RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo,
    @Nullable RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo
)
```

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 `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`.

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 `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` instead of `animateDisappearance` if and only if the ItemAnimator returns `false` from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder)` 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 `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPostLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder)` and the response of that call will be passed to this method as the `postLayoutInfo`.

ItemAnimator must call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` when the animation is complete (or instantly call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` if it decides not to animate the view).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder which should be animated |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPostLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder)`. Might be null if the LayoutManager did not layout the item. |

| Returns |
|---|---|
| `boolean` | true if a later call to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#runPendingAnimations()` is requested, false otherwise. |

### animatePersistence

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract boolean animatePersistence(
    @NonNull RecyclerView.ViewHolder viewHolder,
    @NonNull RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo,
    @NonNull RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo
)
```

Called by the RecyclerView when a ViewHolder is present in both before and after the layout and RecyclerView has not received a `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int)` call for it or a `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` call.

This ViewHolder still represents the same data that it was representing when the layout started but its position / size may be changed by the LayoutManager.

If the Item's layout position didn't change, RecyclerView still calls this method because it does not track this information (or does not necessarily know that an animation is not required). Your ItemAnimator should handle this case and if there is nothing to animate, it should call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` and return `false`.

ItemAnimator must call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` when the animation is complete (or instantly call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` if it decides not to animate the view).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder which should be animated |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo preLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo postLayoutInfo` | The information that was returned from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)`. |

| Returns |
|---|---|
| `boolean` | true if a later call to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#runPendingAnimations()` is requested, false otherwise. |

### canReuseUpdatedViewHolder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public boolean canReuseUpdatedViewHolder(@NonNull RecyclerView.ViewHolder viewHolder)
```

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 `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder` still has the same type (`https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#getItemViewType(int)`). Otherwise, ItemAnimator will always receive both `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder`s in the `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` method.

If your application is using change payloads, you can override `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder,java.util.List<java.lang.Object>)` to decide based on payloads.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder which represents the changed item's old content. |

| Returns |
|---|---|
| `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 returns `true`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder,java.util.List<java.lang.Object>)` |   |

### canReuseUpdatedViewHolder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public boolean canReuseUpdatedViewHolder(
    @NonNull RecyclerView.ViewHolder viewHolder,
    @NonNull List<Object> payloads
)
```

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 `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder` still has the same type (`https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#getItemViewType(int)`). Otherwise, ItemAnimator will always receive both `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder`s in the `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` method.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder which represents the changed item's old content. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/Object.html> payloads` | A non-null list of merged payloads that were sent with change notifications. Can be empty if the adapter is invalidated via `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()`. The same list of payloads will be passed into `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int,java.util.List<java.lang.Object>)` method **if** this method returns `true`. |

| Returns |
|---|---|
| `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 `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder)`. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#canReuseUpdatedViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder)` |   |

### dispatchAnimationFinished

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public final void dispatchAnimationFinished(@NonNull RecyclerView.ViewHolder viewHolder)
```

Method to be called by subclasses when an animation is finished.

For each call RecyclerView makes to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animatePersistence(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, or `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, there should be a matching `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` call by the subclass.

For `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, subclass should call this method for both the `oldHolder` and `newHolder` (if they are not the same instance).

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder whose animation is finished. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#onAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` |   |

### dispatchAnimationStarted

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public final void dispatchAnimationStarted(@NonNull RecyclerView.ViewHolder viewHolder)
```

Method to be called by subclasses when an animation is started.

For each call RecyclerView makes to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animatePersistence(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, or `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, there should be a matching `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationStarted(androidx.recyclerview.widget.RecyclerView.ViewHolder)` call by the subclass.

For `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, subclass should call this method for both the `oldHolder` and `newHolder` (if they are not the same instance).

If your ItemAnimator decides not to animate a ViewHolder, it should call `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)`**without** calling `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationStarted(androidx.recyclerview.widget.RecyclerView.ViewHolder)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder whose animation is starting. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#onAnimationStarted(androidx.recyclerview.widget.RecyclerView.ViewHolder)` |   |

### dispatchAnimationsFinished

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public final void dispatchAnimationsFinished()
```

This method should be called by ItemAnimator implementations to notify any listeners that all pending and active item animations are finished.

### endAnimation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract void endAnimation(@NonNull RecyclerView.ViewHolder item)
```

Method called when an animation on a view should be ended immediately. This could happen when other events, like scrolling, occur, so that animating views can be quickly put into their proper end locations. Implementations should ensure that any animations running on the item are canceled and affected properties are set to their end values. Also, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` should be called for each finished animation since the animations are effectively done when this method is called.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder item` | The item for which an animation should be stopped. |

### endAnimations

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract void endAnimations()
```

Method called when all item animations should be ended immediately. This could happen when other events, like scrolling, occur, so that animating views can be quickly put into their proper end locations. Implementations should ensure that any animations running on any items are canceled and affected properties are set to their end values. Also, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` should be called for each finished animation since the animations are effectively done when this method is called.

### getAddDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public long getAddDuration()
```

Gets the current duration for which all add animations will run.

| Returns |
|---|---|
| `long` | The current add duration |

### getChangeDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public long getChangeDuration()
```

Gets the current duration for which all change animations will run.

| Returns |
|---|---|
| `long` | The current change duration |

### getMoveDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public long getMoveDuration()
```

Gets the current duration for which all move animations will run.

| Returns |
|---|---|
| `long` | The current move duration |

### getRemoveDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public long getRemoveDuration()
```

Gets the current duration for which all remove animations will run.

| Returns |
|---|---|
| `long` | The current remove duration |

### isRunning

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract boolean isRunning()
```

Method which returns whether there are any item animations currently running. This method can be used to determine whether to delay other actions until animations end.

| Returns |
|---|---|
| `boolean` | true if there are any item animations currently running, false otherwise. |

### isRunning

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public final boolean isRunning(
    @Nullable RecyclerView.ItemAnimator.ItemAnimatorFinishedListener listener
)
```

Like `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#isRunning()`, this method returns whether there are any item animations currently running. Additionally, the listener passed in will be called when there are no item animations running, either immediately (before the method returns) if no animations are currently running, or when the currently running animations are `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationsFinished()`.

Note that the listener is transient - it is either called immediately and not stored at all, or stored only until it is called when running animations are finished sometime later.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemAnimatorFinishedListener listener` | A listener to be called immediately if no animations are running or later when currently-running animations have finished. A null listener is equivalent to calling `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#isRunning()`. |

| Returns |
|---|---|
| `boolean` | true if there are any item animations currently running, false otherwise. |

### obtainHolderInfo

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public @NonNull RecyclerView.ItemAnimator.ItemHolderInfo obtainHolderInfo()
```

Returns a new `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` which will be used to store information about the ViewHolder. This information will later be passed into `animate**` methods.

You can override this method if you want to extend `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` and provide your own instances.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` | A new `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo`. |

### onAnimationFinished

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public void onAnimationFinished(@NonNull RecyclerView.ViewHolder viewHolder)
```

Called after `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` is called by the ItemAnimator.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder whose animation is finished. There might still be other animations running on this ViewHolder. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationFinished(androidx.recyclerview.widget.RecyclerView.ViewHolder)` |   |

### onAnimationStarted

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public void onAnimationStarted(@NonNull RecyclerView.ViewHolder viewHolder)
```

Called when a new animation is started on the given ViewHolder.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder which started animating. Note that the ViewHolder might already be animating and this might be another animation. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#dispatchAnimationStarted(androidx.recyclerview.widget.RecyclerView.ViewHolder)` |   |

### recordPostLayoutInformation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public @NonNull RecyclerView.ItemAnimator.ItemHolderInfo recordPostLayoutInformation(
    @NonNull RecyclerView.State state,
    @NonNull RecyclerView.ViewHolder viewHolder
)
```

Called by the RecyclerView after the layout is complete. Item animator should record necessary information about the View's final state.

The data returned from this method will be passed to the related `animate**` methods.

The default implementation returns an `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` which holds the bounds of the View.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.State state` | The current State of RecyclerView which includes some useful data about the layout that will be calculated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder whose information should be recorded. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` | An ItemHolderInfo that preserves necessary information about the ViewHolder. This object will be passed back to related `animate**` methods when RecyclerView decides how items should be animated. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPreLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder,int,java.util.List<java.lang.Object>)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animatePersistence(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |

### recordPreLayoutInformation

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public @NonNull RecyclerView.ItemAnimator.ItemHolderInfo recordPreLayoutInformation(
    @NonNull RecyclerView.State state,
    @NonNull RecyclerView.ViewHolder viewHolder,
    @RecyclerView.ItemAnimator.AdapterChanges int changeFlags,
    @NonNull List<Object> payloads
)
```

Called by the RecyclerView before the layout begins. Item animator should record necessary information about the View before it is potentially rebound, moved or removed.

The data returned from this method will be passed to the related `animate**` methods.

Note that this method may be called after pre-layout phase if LayoutManager adds new Views to the layout in pre-layout pass.

The default implementation returns an `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` which holds the bounds of the View and the adapter change flags.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.State state` | The current State of RecyclerView which includes some useful data about the layout that will be calculated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ViewHolder viewHolder` | The ViewHolder whose information should be recorded. |
| `@https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.AdapterChanges int changeFlags` | Additional information about what changes happened in the Adapter about the Item represented by this ViewHolder. For instance, if item is deleted from the adapter, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#FLAG_REMOVED()` will be set. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/Object.html> payloads` | The payload list that was previously passed to `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int,java.lang.Object)` or `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeChanged(int,int,java.lang.Object)`. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator.ItemHolderInfo` | An ItemHolderInfo instance that preserves necessary information about the ViewHolder. This object will be passed back to related `animate**` methods after layout is complete. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#recordPostLayoutInformation(androidx.recyclerview.widget.RecyclerView.State,androidx.recyclerview.widget.RecyclerView.ViewHolder)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animatePersistence(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)` |   |

### runPendingAnimations

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public abstract void runPendingAnimations()
```

Called when there are pending animations waiting to be started. This state is governed by the return values from `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateAppearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateChange(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)``https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animatePersistence(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, and `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.ItemAnimator#animateDisappearance(androidx.recyclerview.widget.RecyclerView.ViewHolder,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo,androidx.recyclerview.widget.RecyclerView.ItemAnimator.ItemHolderInfo)`, which inform the RecyclerView that the ItemAnimator wants to be called later to start the associated animations. runPendingAnimations() will be scheduled to be run on the next frame.

### setAddDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public void setAddDuration(long addDuration)
```

Sets the duration for which all add animations will run.

| Parameters |
|---|---|
| `long addDuration` | The add duration |

### setChangeDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public void setChangeDuration(long changeDuration)
```

Sets the duration for which all change animations will run.

| Parameters |
|---|---|
| `long changeDuration` | The change duration |

### setMoveDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public void setMoveDuration(long moveDuration)
```

Sets the duration for which all move animations will run.

| Parameters |
|---|---|
| `long moveDuration` | The move duration |

### setRemoveDuration

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

```
public void setRemoveDuration(long removeDuration)
```

Sets the duration for which all remove animations will run.

| Parameters |
|---|---|
| `long removeDuration` | The remove duration |