Open In App

How to insert Slide From Bottom animation in RecyclerView in Android

Last Updated : 08 Jul, 2020
Like Article

In this article, the animation that makes the items slide from the bottom is added in the recycler view. Here we don`t use any other library to add the animation. Adding animations make the application attractive and give a better user experience.

Step 1: Create  “anim”  resource directory
Right-click on res folder and follow path 

res -> new -> Android Resource Directory

 From the Resource type, choose “anim” and don’t change  Directory name then press ok.
Step 2: Create an Animation file.
Right-click on “anim” directory and create a new Animation Resource File. 

anim -> new -> Animation Resource File -> create “slide_from_bottom” xml file.

Add the below code in slide_from_bottom.xml file. Here the animation is defined. 


<?xml version="1.0" encoding="utf-8"?>

Step 3: Create one more animation file to hold “slide_from_bottom.xml” 

anim -> new -> Animation Resource File -> create “layout_animation_slide_from_bottom” xml file

 Add the below code in the XML file that is just created. Here, animation slide_from_buttom  is added that is defined in the previous step.


<?xml version="1.0" encoding="utf-8"?>

Step 4:(Final) Call that animation in Your RecyclerView. In the tag layoutAnimation, add layout_animation_slide_from_bottom.xml. Now while displaying the list items in recycler view, the items will add with the animation that is carried by the layout_animation_slide_from_bottom.xml and defined in slide_from_bottom.xml.


<?xml version="1.0" encoding="utf-8"?>


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads