How to Add an ellipsis in a TextView
机器人:在API级别ellipsize加入1- .An省略号是在一排三个时期。 (...)。
在XML
....
android:text="Hi I am Amiyo,you can see how to ellipse works."
android:ellipsize = "end"
/>
在这一点上,省略号将尚未作为一个TextView设置输入新的文本时上默认自动扩展显示。您需要以某种方式限制TextView。要做到这一点,您可以使用添加到您的TextView a scrollHorizontally, minLines, or maxLines来省略号显示。
为了使椭圆:
at the end: this is how it would...
use: android:ellipsize = "end"
而且
in the middle: this is ...how it would
use: android:ellipsize = "middle"
而且
at the start: ...this is how it would
use: android:ellipsize = "start"
而且
to have no ellipse
use: android:ellipsize = "none"
请注意:
Do not use android:singeLine = "true", it is deprecated.
android:maxLines = "1" will not display the three dots (...)
android:lines = "1" will not display the three dots (...)
有关详细信息,您可以点击这里查看