Sliding Up Screen in Android
Sliding Up Screen is another common feature that we see in most of the apps. This Sliding Up Screen can be used for displaying some content after clicking the button or to display Menu. Using this Sliding Up Screen in our App improves the User Experience. In this article, we are going to see how to implement the Sliding Up Screen in Android. A sample GIF is given below to get an idea about what we are going to do in this article.
Applications of Sliding Up Screen
- Sliding Up Screen can be used to show some content after clicking the button in another attractive form.
- This Sliding Up Screen can also be used to display additional Menu Options.
- Using Sliding Up Screen in our app improves User Experience.
Attributes of Sliding Up Screen
|layout_width||Used to give layout Width.|
|layout_height||Used to give layout height.|
|gravity||Used to give gravity.|
|umanoPanelHeight||Used to give height to the panel.|
|umanoShadowHeight||Used to display shadow height.|
Step by Step Implementation
Step 1: Create a New Project
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.
Step 2: Add dependency of Sliding Up Screen library in build.gradle file
Then Navigate to Gradle scripts and then to build.gradle(Module) level. Add below line in build.gradle file in the dependencies section.
now click on Sync now it will sync your all files in build.gradle().
Step 3: Create a new Sliding Up Screen in your activity_main.xml file
Navigate to the app > res > layout to open the activity_main.xml file. Below is the code for the activity_main.xml file.
Step 4: Create a screen1 and screen 2 in the layout folder
Navigate to the app > res > layout and create layout_first.xml and layout_second.xml file in the layout folder. Follow the code given below.
Now click on the run option it will take some time to build Gradle. After that, you will get output on your device as given below.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.