I have a TextView and want to show it with animation.
but when I set a text over screen width, it will be cut
How can I fix it.
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="100dp"
android:background="#0000ff"
android:lines="1"
android:text="startmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmend"
android:textColor="@color/white"
android:textSize="20dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
How I animate it
val bounds = Rect()
viewBinding.textView.paint.getTextBounds(
viewBinding.textView.text.toString(),
0,
viewBinding.textView.text.length, bounds)
viewBinding.textView
.animate()
.setInterpolator(LinearInterpolator())
.x((screenWidth - bounds.width()).toFloat())
.duration = 5000