滚动文本不起作用

Scrolling Text not working

我的 activity 布局中有以下 textView,我希望它自动水平滚动,但这并没有发生。这里有人知道为什么会这样吗?

    <TextView
    android:id="@+id/superAttackDesc"
    android:layout_width="314dp"
    android:layout_height="21dp"
    android:layout_marginBottom="5dp"
    android:layout_marginStart="8dp"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:fontFamily="monospace"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:singleLine="true"
    android:textAlignment="viewStart"
    android:textColor="@android:color/white"
    android:textStyle="italic"
    app:layout_constraintBottom_toBottomOf="@+id/cardDetailsImageView"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintHorizontal_bias="0.753"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/superAttackTitle"
    app:layout_constraintVertical_bias="0.175" />

1) 使textview水平滚动设置android:singleLine = true and android:ellipsize="marquee"

2) 确保在 Parent Activity 的 onCreate 中选择了 TextView。

findViewById(R.id.SAMPLE).setSelected(true);

代码参考:

<TextView
 android:id="@+id/SAMPLE"
 android:layout_width="..."
 android:layout_height="..."
 android:ellipsize="marquee"
 android:marqueeRepeatLimit="marquee_forever"
 android:singleLine="true"
 android:text="@string/SAMPLE"/>