TextSwitcherpublic class TextSwitcher extends ViewSwitcher Specialized {@link android.widget.ViewSwitcher} that contains
only children of type {@link android.widget.TextView}.
A TextSwitcher is useful to animate a label on screen. Whenever
{@link #setText(CharSequence)} is called, TextSwitcher animates the current text
out and animates the new text in. |
Methods Summary |
---|
public void | addView(android.view.View child, int index, ViewGroup.LayoutParams params){@inheritDoc}
if (!(child instanceof TextView)) {
throw new IllegalArgumentException(
"TextSwitcher children must be instances of TextView");
}
super.addView(child, index, params);
| public void | setCurrentText(java.lang.CharSequence text)Sets the text of the text view that is currently showing. This does
not perform the animations.
((TextView)getCurrentView()).setText(text);
| public void | setText(java.lang.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.
final TextView t = (TextView) getNextView();
t.setText(text);
showNext();
|
|