J'utilise ce code pour faire un défilement automatique lorsque la longueur de testView dépasse la largeur de l'écran: -
<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" />
Je veux faire défiler le caractère sans trois points. Le code ci-dessus fait défiler le caractère mais à la fin, trois points sont affichés.
Réponses:
0 pour la réponse № 1essayez le code ci-dessous:
<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" />
Référer : Le texte défilant TextView ne fonctionne pas
0 pour la réponse № 2
Essayez ceci, ajoutez les attributs ci-dessous à votre TextView
. Tu es absent android:ellipsize="marquee"
attribuer dans votre xml
android:ellipsize="marquee"
android:focusable="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
Et aussi définir vrai pour vous TextView
en code java
TextView tViewWork = (TextView) findViewById(R.id.tViewWork);
tViewWork.setSelected(true);
-1 pour la réponse № 3
retirer
android: singleLine = "true", il prend automatiquement autant de largeur et de hauteur qu'il le souhaite