public class

ViewFlipper

extends ViewAnimator
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ android.widget.ViewAnimator
           ↳ android.widget.ViewFlipper

Class Overview

Simple ViewAnimator that will animate between two or more views that have been added to it. Only one child is shown at a time. If requested, can automatically flip between each child at a regular interval.

Summary

XML Attributes
Attribute Name Related Method Description
android:autoStart When true, automatically start animating

Must be a boolean value, either "true" or "false". 

android:flipInterval  
[Expand]
Inherited XML Attributes
From class android.widget.ViewAnimator
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
ViewFlipper(Context context)
ViewFlipper(Context context, AttributeSet attrs)
Public Methods
boolean isAutoStart()
Returns true if this view automatically calls startFlipping() when it becomes attached to a window.
boolean isFlipping()
Returns true if the child views are flipping.
void setAutoStart(boolean autoStart)
Set if this view automatically calls startFlipping() when it becomes attached to a window.
void setFlipInterval(int milliseconds)
How long to wait before flipping to the next view
void startFlipping()
Start a timer to cycle through child views
void stopFlipping()
No more flips
Protected Methods
void onAttachedToWindow()
This is called when the view is attached to a window.
void onDetachedFromWindow()
This is called when the view is detached from a window.
void onWindowVisibilityChanged(int visibility)
Called when the window containing has change its visibility (between GONE, INVISIBLE, and VISIBLE).
[Expand]
Inherited Methods
From class android.widget.ViewAnimator
From class android.widget.FrameLayout
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

XML Attributes

android:autoStart

When true, automatically start animating

Must be a boolean value, either "true" or "false".

This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

This corresponds to the global attribute resource symbol autoStart.

Related Methods

android:flipInterval

Related Methods

Public Constructors

public ViewFlipper (Context context)

Since: API Level 1

public ViewFlipper (Context context, AttributeSet attrs)

Since: API Level 1

Public Methods

public boolean isAutoStart ()

Since: API Level 7

Returns true if this view automatically calls startFlipping() when it becomes attached to a window.

public boolean isFlipping ()

Since: API Level 1

Returns true if the child views are flipping.

public void setAutoStart (boolean autoStart)

Since: API Level 7

Set if this view automatically calls startFlipping() when it becomes attached to a window.

public void setFlipInterval (int milliseconds)

Since: API Level 1

How long to wait before flipping to the next view

Parameters
milliseconds time in milliseconds

public void startFlipping ()

Since: API Level 1

Start a timer to cycle through child views

public void stopFlipping ()

Since: API Level 1

No more flips

Protected Methods

protected void onAttachedToWindow ()

Since: API Level 1

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

protected void onDetachedFromWindow ()

Since: API Level 1

This is called when the view is detached from a window. At this point it no longer has a surface for drawing.

protected void onWindowVisibilityChanged (int visibility)

Since: API Level 1

Called when the window containing has change its visibility (between GONE, INVISIBLE, and VISIBLE). Note that this tells you whether or not your window is being made visible to the window manager; this does not tell you whether or not your window is obscured by other windows on the screen, even if it is itself visible.

Parameters
visibility The new visibility of the window.