AnimatedRecyclerView: Our New Library on GitHub
What is AnimatedRecyclerView?
Animated RecyclerView is a library that allows you to animate a recycler view in your project like Google does it in its Google Play Store. Only the first visible items are animated there and you will see no animation when the recycler view scrolls up.
Reasons to Use It
This library solves several problems:
- It works stably fast and without jerks.
- It doesn’t need to utilize the adapter to animate items when they appear for the first time.
Why We Created AnimatedRecyclerView?
While working on a project, we needed to add an animation similar to the one used in the Google Play Store but didn’t find any appropriate library on Github that could help us with this task. We decided to create our own library to reuse it in other projects.
How We Did It
The standard implementation consists of two main animation types:
- Item animation
- Layout animation
Let’s go through all steps of implementation out of the box.
First of all, it’s necessary to define a file called
res/anim/. This animation is used for each item of the RecyclerView.
The next step is to create a file
res/anim/ that uses the item animation from the code snippet above.
Finally it’s necessary to apply the created layout animation. There are two ways of doing it:
- XML layout
This is how we start the animation we’ve just created:
Looking to learn more about Animated RecyclerView?
Visit MLSDev profile on GitHub for more information about our library.
Our Way of Implementing Animations
We already defined some item/layout animations and you don’t need to go through the first two steps described above. In case you still want to define any other item/layout animation you can easily do it and use it with our AnimatedRecyclerView.
If the animations defined by us work for you, you can begin straight from applying a layout animation using one of the already mentioned ways:
- From the code
- From the XML layout
Now you can start your animation:
Or your RecyclerView should extend the Animated RecyclerView and an adapter should be set:
Want to learn more about our Android development services?
Get in touch with us to discuss your Android project and learn how our team can assist you.