3018 views
# Creating Custom Item Animators in Android This guide is for creating custom animations for items in a `RecyclerView`. Start by reviewing the [RecyclerView guide animation section here](http://guides.codepath.com/android/Using-the-RecyclerView#animators). ## RecyclerView.ItemAnimator and DefaultItemAnimator Animation starts with the [RecyclerView.ItemAnimator](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.ItemAnimator.html) abstract class. The [DefaultItemAnimator](https://developer.android.com/reference/android/support/v7/widget/DefaultItemAnimator.html) (see [source code](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v7/recyclerview/src/android/support/v7/widget/DefaultItemAnimator.java)) extends `SimpleItemAnimator` which then itself extends `RecyclerView.ItemAnimator`. ## SimpleItemAnimator [SimpleItemAnimator](https://developer.android.com/reference/android/support/v7/widget/SimpleItemAnimator.html) (see [source code](https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v7/recyclerview/src/android/support/v7/widget/SimpleItemAnimator.java)) is a wrapper class for ItemAnimator that makes animation easier. ## Custom Animator Examples There are a few examples of how to customize animations using this class: * [Custom ItemAnimator](https://github.com/brijtz/Android_WorkingBeez/blob/594905ea2a198af36ae493d7f6918a8f0ac5ff4e/app/src/main/java/com/app/workingbeez/utils/ItemAnimator.java) * [SlideUpItemAnimator](https://github.com/MM2-0/QAMEL-App/blob/60ab0506606be7c74209b3cb04191c791777c94b/app/src/main/java/de/qa/view/animator/SlideUpItemAnimator.java) * [SlideInDownAnimator](https://github.com/huangxiaoyu/Interessant/blob/f627773618d24c262fc859f5fa6a6c23af84b710/app/src/main/java/me/zsj/interessant/utils/SlideInDownAnimator.java) Check the following custom animators defined: * [Mike Penz's Item Animators](https://github.com/mikepenz/ItemAnimators/tree/develop/library/src/main/java/com/mikepenz/itemanimators) * [Wasabeef Animators](https://github.com/wasabeef/recyclerview-animators/tree/master/animators/src/main/java/jp/wasabeef/recyclerview/animators) ## Further References **Stackoverflow Posts** * [How to create insert animation effect?](http://stackoverflow.com/a/28986402/313399) * [How to animate RecyclerView items when they appear?](http://stackoverflow.com/a/26748274/313399) **Tutorials** * [Creating custom item animator implementation for RecyclerView](http://blog.trsquarelab.com/2015/12/creating-custom-animation-in.html) * [Mastering Complex Lists with the Android RecyclerView](https://www.sitepoint.com/mastering-complex-lists-with-the-android-recyclerview/)