Android ViewAnimator - Androhub

ViewAnimator

Android ViewAnimator

A ViewAnimator  is used to animate or switch between the screens.

To learn Basic of Android Animation  go to  Android Animation Tutorial.

Example

In this example i will show how to use ViewAnimator  to switch between screen with Animation.

VIDEO DEMO

Let’s get start by creating a project in Eclipse IDE.

1. Create a new project in Eclipse by navigating to File ⇒ New Android ⇒ Application Project and fill required details. (I kept my main activity name as MainActivity.java)

2.  Create a layout file for MainActivtiy.java under res ⇒ layout folder. I named the layout file as activity_main.xml. In this layout i had taken ViewAnimator and inside it i had taken some views like ImageView, Button, TextView, etc.

3. Now, add the following code to MainActivity.java , in this activity i am going to show how to switch between the view using animations.

4. Finally, run the app and you will get the output as shown in video.

Thanks. :)

 

Post comment

Your email address will not be published. Required fields are marked *