Nowadays users are interacting with material design application. Material design applications are eye catching app which uses some effects like animation and material color to their app. If you are looking to make show and hide a view with a scroll or slide down and up screen with animate effect to android image view, text view or custom view, you are in right place. In this tutorial, you will learn to show and hide any android view when scroll/slide the screen with animation effect.
Here all these animations are made only by using XML code, you not need to have knowledge of java programming during this time.
Android Example: How to Show and Hide a View with a Slide Up/Down Screen with Animation
First things you have to do is open build.gradle file of your app and add compile ‘com.github.flavienlaurent.discrollview:library:0.0.2@aar’ as project dependency. Build.gradle file will look like below.
Now we will be working in XML layout file and all things will be done here. Open your project XML layout file and change your root layout to com.flavienlaurent.discrollview.lib.DiscrollView and add a new widget com.flavienlaurent.discrollview.lib.DiscrollViewContent inside that layout with layout_height and layout_width match_parent attributes. All content/widgets/views that you want to animate goes inside second widget with different attributes. Following is the complete content of sample project example you can paste below code to your project XML layout file.
Following is the default code of java activity file.
Now, run your Show and Hide Android Views When Scroll the Screen With Animation Effect application and scroll down and up the screen you will see different views with different animation effect. This will look like the above gif demo.