Android
android.widget
public class

android.widget.TextSwitcher

java.lang.Object
android.view.View Drawable.Callback KeyEvent.Callback
android.view.ViewGroup ViewManager ViewParent
android.widget.FrameLayout
android.widget.ViewAnimator
android.widget.ViewSwitcher
android.widget.TextSwitcher

A TextSwitcher is a specialized ViewSwitcher that contains only children of type TextView. A TextSwitcher is useful to animate a label on screen. Whenever setText(CharSequence) is called, TextSwitcher animates the current text out and animates the new text in.

Summary

XML Attributes inherited from class android.widget.FrameLayout
XML Attributes inherited from class android.view.ViewGroup
XML Attributes inherited from class android.view.View
Constants inherited from class android.view.ViewGroup
Constants inherited from class android.view.View
Fields inherited from class android.view.ViewGroup
Fields inherited from class android.view.View

Public Constructors

            TextSwitcher(Context context)
Creates a new empty TextSwitcher.
            TextSwitcher(Context context, AttributeSet attrs)
Creates a new empty TextSwitcher for the given context and with the specified set attributes.

Public Methods

          void  addView(View child, int index, ViewGroup.LayoutParams params)
Adds a child view with the specified layout parameters.
          void  setCurrentText(CharSequence text)
Sets the text of the text view that is currently showing.
          void  setText(CharSequence text)
Sets the text of the next view and switches to the next view.
Methods inherited from class android.widget.ViewSwitcher
Methods inherited from class android.widget.ViewAnimator
Methods inherited from class android.widget.FrameLayout
Methods inherited from class android.view.ViewGroup
Methods inherited from class android.view.View
Methods inherited from class java.lang.Object
Methods inherited from interface android.graphics.drawable.Drawable.Callback
Methods inherited from interface android.view.KeyEvent.Callback
Methods inherited from interface android.view.ViewManager
Methods inherited from interface android.view.ViewParent

Details

Public Constructors

public TextSwitcher(Context context)

Creates a new empty TextSwitcher.

Parameters

context the application's environment

public TextSwitcher(Context context, AttributeSet attrs)

Creates a new empty TextSwitcher for the given context and with the specified set attributes.

Parameters

context the application environment
attrs a collection of attributes

Public Methods

public void addView(View child, int index, ViewGroup.LayoutParams params)

Adds a child view with the specified layout parameters.

Parameters

child the child view to add
index the position at which to add the child
params the layout parameters to set on the child

Throws

IllegalArgumentException if child is not an instance of TextView

public void setCurrentText(CharSequence text)

Sets the text of the text view that is currently showing. This does not perform the animations.

Parameters

text the new text to display

public void setText(CharSequence text)

Sets the text of the next view and switches to the next view. This can be used to animate the old text out and animate the next text in.

Parameters

text the new text to display
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:56