The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
ViewFlipper behaves a bit like a
FrameLayout that is set up such that
only one child can be visible at a time. You can control which of those
children is visible, either by index or via
methods to rotate between them.
You can also set up animated effects to control how a child leaves and the next one enters, such as applying a sliding effect.
And, you can set up
ViewFlipper to automatically flip between children
on a specified period, without further developer involvement. This,
coupled with the animation, can be used for news tickers, ad banner
rotations, or the like where light animations (e.g., fade out and fade
in) can be used positively.
ViewFlipper can have as many children as needed (within memory constraints), though
you will want at least two for it to be meaningful.
By default, the transition between children is an immediate “smash cut” — the old one
vanishes and the new one appears instantaneously. You can call
setOutAnimation() to supply an
Animation object or resource to use
for the transitions instead.
By default, the
ViewFlipper will show its first child and stay there. You can
manually flip children via
the latter of which taking a position index of which child to display. You can also
have automatic flipping, by one of two means:
android:flipIntervalwill set up the amount of time to display each child before moving to the next, and
android:autoStartwill indicate if the automated flipping should begin immediately or not
setFlipInterval()serves the same role as
android:flipInterval, and you can control when flipping is enabled via
The preview of this section took that left turn at Albuquerque.
The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.