prevent undesired line wrapping in TextView

房东的猫 提交于 2019-12-03 04:43:53
Graham Povey

Add the following to your TextView definition:

android:maxLines="1"

The option shown below is deprecated

android:singleLine="true"

Instead use this:

android:maxLines="1"
invertigo

From TextView Ellipsize (...) not working :

 <TextView android:id="@+id/lName"
      android:style="@style/autoscroll" />

And in your style.xml

 <style name="autoscroll">
    <item name="android:singleLine">true</item>
    <item name="android:ellipsize">marquee</item>
    <item name="android:marqueeRepeatLimit">marquee_forever</item>
    <item name="android:focusable">true</item>
    <item name="android:focusableInTouchMode">true</item>
    <item name="android:scrollHorizontally">true</item>
</style>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!