Android RecyclerView With Beautiful Animations

Complexities and animations with one of Android’s most important classes

Photo by Matam Jaswanth on Unsplash

Initial Setup and Basic Animation

You are going to need the following dependencies in order to make this project.

As you know, I work on Android data binding so let's enable it by adding the following lines of code in our app.gradle file.

enabled true

Hope you are all set! Now let's make a layout that will be responsible for holding each row of RecyclerView — like this.

Create item_list.xml in your layout folder.

Now let's make a model class. As you can see, I’m showing a list of different people with their name, image, and placeholder description (in lorem ipsum text). Each item of RecyclerView holds a single object of These objects are created by a model class that I created with the name

It’s time to make RecyclerAdapter because RecyclerView needs an adapter to perform its whole functionality. I have created a class called and inherited it from RecyclerView.Adapter.
Add the following lines of code in your project.

Before going any further, let's try to run our app and see what we have done so far. To make it run, we require some data to populate our RecyclerView. For this, I’ve created some dummy arrays. Create array.xml inside your res/values.

people_images are dummy images that I have included in my project. You can have pictures of your own choice.

I am generating data using the following code in your MainActivity.xml .

Your activity_main.xml should look like this.

Let's run the app and see if everything is working fine up till now.

Made good progress? Now everything is working fine. It’s time to introduce animations in our RecyclerView.

Fade-In Animation

I’m making fade-in animation first. All you need to is to add the following lines of code in your project.

setAnimation() is responsible for making animation in RecyclerView.

AnimatorSet()This class works like an array that takes different animations and makes them play.

ObjectAnimator(): This class performs different animations.

Let’s run the app!

Items are loading with a fade-in effect! Let’s introduce some more effects.

Left-to-Right Animation

In order to make items enter from left to right, let’s add following to your code.

Make sure to update your DURATION to equal 150.

Right-to-Left Animation

To animate right to left, use the following code.

Done! I hope you enjoyed the tutorial. Thank you so very much for your time. Happy coding!