2017-12-18 18 views
0

Ich habe den folgenden textView im Layout meiner Aktivität und ich möchte es horizontal automatisch scrollen, aber das passiert nicht. Weiß jemand hier, warum das passiert?Scrolling Text funktioniert nicht

<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" /> 
+2

was meinen Sie ** horizontal automatisch scrollen ** –

+0

@AmitVaghela höchstwahrscheinlich blättern, wenn der Text zu breit ist, anstatt neue Zeilen hinzuzufügen? – Zoe

Antwort

0

1) Zur Textview horizontale Scroll android:singleLine = true und android:ellipsize = "Marquee" Make

2) festgelegt stellen Sie sicher, dass Textview in onCreate der Mutter Aktivität ausgewählt ist.

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

-Code-Referenz:

<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"/> 
Verwandte Themen