/ / Automatyczne przewijanie tekstu Zobacz bez trzech kropek - Android, Android-textview

Auto scroll textView bez trzech kropek - android, android-textview

Używam tego kodu do automatycznego przewijania, gdy długość testView jest większa niż szerokość ekranu: -

<TextView
android:id="@+id/tViewWork"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center_vertical"
android:marqueeRepeatLimit="marquee_forever"
android:padding="3dp"
android:scrollHorizontally="true"
android:selectAllOnFocus="true"
android:singleLine="true"
android:text="Name of work: "
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#dedfdc"
android:textStyle="bold" />

Chcę przewijać znak bez trzech kropek. Powyższy kod przewija znak, ale na końcu wyświetla się trzy kropki.

wprowadź opis obrazu tutaj

Odpowiedzi:

0 dla odpowiedzi № 1

spróbuj poniżej kodu:

<TextView android:id="@+id/fact" android:layout_width="200dp"
android:text="Loading... More text to see if it spans or not and want more"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:duplicateParentState="true">
<requestFocus android:focusable="true" android:focusableInTouchMode="true"
android:duplicateParentState="true" />

Zobacz: TextView Marquee nie działa


0 dla odpowiedzi nr 2

Spróbuj tego, dodaj poniższe atrybuty do swojego TextView. Brakuje ci android:ellipsize="marquee" atrybut w pliku xml

   android:ellipsize="marquee"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"

A także ustaw wybraną dla Ciebie wartość true TextView w kodzie java

  TextView tViewWork = (TextView) findViewById(R.id.tViewWork);
tViewWork.setSelected(true);

-1 dla odpowiedzi nr 3

usunąć
android: singleLine = "true" automatycznie przyjmie tyle szerokości i wysokości, ile chce