Marquee behavior in TextView: Android
2 min readAug 15, 2020
What we are going to achieve is Marquee’s behavior using animation.
Now let’s see how we can achieve this.
Firstly we need two textView inside a frame layout, both having the same text (will be discussed later). For the above design, I will write like this:-
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/bt_animate_text"
android:layout_centerInParent="true"
android:layout_marginLeft="8dp"
android:layout_marginEnd="76dp"
android:layout_marginRight="76dp"
android:layout_marginBottom="32dp"
android:layout_marginStart="8dp"> <TextView
android:id="@+id/tv_actual_text"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="24dp"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:text="Animating text"/>
<TextView
android:id="@+id/tv_dummy_text"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textSize="24dp"
android:ellipsize="end"
android:gravity="center"
android:singleLine="true"
android:text="Animating text"/>…