Android ViewFlipper

Android ViewFlipper

ViewFlipper is an extension class of ViewAnimator, which animates between two or more views that have been added to it. Specfically, only one child is shown at a time.

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

To get a better understanding, suppose that we have two TextViews that will be used in our app, but we want only one to be displayed at a time. That is, here is the most popular use case that ViewFlipper fits in.


In this example i will demonstrate you how to work on viewflipper with animations.


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

2.  Create a layout file for under res ⇒ layout folder. I named the layout file as activity_main.xml. In this layout i had taken one viewfilpper for flipping the views and inside the viewflipper i had taken four different views.

3. Now, create a new folder in res folder naming anim for animation files. In this folder create two xml files naming left_out.xml and right_enter.xml.

4. Now, add the following code to your In this file i am going to show using of viewflipper.

5. Now, run the app and you will get the output as shown in video.

Thanks. :)

Download Source Code


About the author

I am an Android developer for whom Android is the one and only love. I work as a freelancer which gets me and Android closer. I always love to share my learnings and love to learn from others knowledge too.

Leave a Comment

Comment (required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Name (required)
Email (required)