Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Java Arrays
  • Java Strings
  • Java OOPs
  • Java Collection
  • Java 8 Tutorial
  • Java Multithreading
  • Java Exception Handling
  • Java Programs
  • Java Project
  • Java Collections Interview
  • Java Interview Questions
  • Java MCQs
  • Spring
  • Spring MVC
  • Spring Boot
  • Hibernate
Open In App
Next Article:
How to insert Slide From Bottom animation in RecyclerView in Android
Next article icon

How to insert Slide From Bottom animation in RecyclerView in Android

Last Updated : 08 Jul, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

Approach:
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
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"     android:duration="600"> <translate     android:fromYDelta="50%p"     android:interpolator="@android:anim/accelerate_decelerate_interpolator"     android:toYDelta="0"/> <alpha     android:fromAlpha="0"     android:interpolator="@android:anim/accelerate_decelerate_interpolator"     android:toAlpha="1"/> </set> 

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
<?xml version="1.0" encoding="utf-8"?> <layoutAnimation   xmlns:android="http://schemas.android.com/apk/res/android"   android:animation="@anim/slide_from_bottom"   android:animationOrder="normal"   android:delay="15%"> </layoutAnimation> 

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
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout      xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="#6F6A6A"     tools:context=".MainActivity">      <androidx.recyclerview.widget.RecyclerView         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layoutAnimation="@anim/layout_animation_slide_from_bottom"         android:orientation="vertical"         android:id="@+id/recyclerView"         />  </androidx.constraintlayout.widget.ConstraintLayout> 

Output:


Next Article
How to insert Slide From Bottom animation in RecyclerView in Android

I

introidx
Improve
Article Tags :
  • Java
  • How To
  • Android
Practice Tags :
  • Java

Similar Reads

    How to Add Fade and Shrink Animation in RecyclerView in Android?
    In this article, we are going to show the fade and shrink animation in RecyclerView. When we move downward then the item at the top will be fading out and then it will shrink. In the output, we can see how it is happening. We will be implementing Java/Kotlin programming language.Step by Step Impleme
    15+ min read
    How to Animate RecyclerView Items in Android?
    RecyclerView Item animation is one of the modern features that we can add to our Android app, the basic working of this is when any user opens our app then the data items that are present in recycler view will animate and then it will show to the user.it is so easy to implement also it can enhance t
    5 min read
    Create Floating Animation for RecyclerView Items in Android
    In Android, a RecyclerView is a UI element that is used to display a type of layout items in the form of a list. This list is scrollable and each element of the list is clickable. You can find more information on creating RecyclerView in this article: RecyclerView in Android with Example. RecyclerVi
    5 min read
    How to Implement RecyclerView in a Fragment in Android?
    In Android, a fragment is a modular section of a user interface that can be combined with other fragments to create a flexible and responsive application.  A fragment represents a behavior or a portion of the user interface in an Activity, which can be reused in different activities or layouts. It h
    12 min read
    How to add Bullet list in a RecyclerView in Android?
    Recycler View allows us to show a list of items but to convert our list into the bulleted list we have to do some extra work. You can do this task by following these simple steps given below:- Add the support Library in build.gradle file for Recycler View in the dependencies section.  XML <depend
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences