Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.


Show the video description

In this video we will learn how to use the ViewFlipper widget, which is a subclass of ViewAnimator and makes it easy to switch between different views at runtime.
We can set animations on it either in XML with android:inAnimation and android:outAnimation or in Java code with setInAnimation and setOutAnimation.
With showPrevious and showNext we can flip between views, or alternatively we can let the ViewFlipper switch views automatically either by calling startFlipping after setting an interval with setFlipInterval, or by setting autoStart to true.
With addView we can add dynamically created views to the ViewFlipper in Java code, like a TextView for example.