防止在TextView中进行不必要的换行 [英] prevent undesired line wrapping in TextView
本文介绍了防止在TextView中进行不必要的换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尽管设置了 lines ="1"
和 ellipsise ="end"
,我的textview仍在换行.除了防止换行符的文字按预期的样子用"..."省略掉外,我还需要做什么?
My textview is wrapping text despite the settings lines="1"
and ellipsise="end"
. What do I need to do in addition to prevent the line wrapping hand have the text ellipsised with a "..." as intended?
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/date"
android:background="@color/listHeaderBackground"
android:ellipsize="end"
android:gravity="left|center_vertical"
android:height="30dp"
android:lines="1"
android:maxLines="1"
android:paddingBottom="3dp"
android:paddingLeft="20dp"
android:paddingRight="7dp"
android:paddingTop="3dp"
android:text="New Ion Beam Etcher ordered blah blah blah blah"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/listHeaderForeground" />
请参阅第三项:新溅射工具"等.
see the third item: "New sputter tool" etc.
推荐答案
将以下内容添加到TextView定义中:
Add the following to your TextView definition:
android:maxLines="1"
这篇关于防止在TextView中进行不必要的换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文