Marquee using maxLines

最后都变了- 提交于 2019-12-01 19:45:27

You can try using this :

android:maxLength = "10"

OR

After setting android:maxLines="1", you have to set your inputType too. So, set your android:inputType="text" and that should do the trick.

In XML

<TextView
    android:text="11111111111111111111111111111111111111111111111111111111111111"
    android:id="@+id/text_marquee"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:maxLines="1"
    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever"
    />

In Java

((TextView)findViewById(R.id.text_marquee)).setHorizontallyScrolling(true);
((TextView)findViewById(R.id.text_marquee)).setSelected(true);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!