Android TextSwitcher
TextSwitcher:
ViewSwitcher has a Variety called TextSwitcher associated with it that is designed to switch between two TextViews only.
Most of the time it is provided when updating the text contents such as messages, captions inside a user interface, when a transition or an animation is expected.
Example:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".TextSwitcherExample"
android:padding="16dp"
android:orientation="vertical"
android:gravity="center_horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Text Switcher Example"
android:textSize="26sp"
android:textColor="@color/colorOrange"
android:layout_marginBottom="50dp"
/>
<TextSwitcher
android:id="@+id/textswitcher1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Next"
android:textColor="@color/colorWhite"
android:background="@color/colorPrimaryDark"
android:layout_marginTop="47dp"
/>
</LinearLayout>
Output