简体   繁体   English

如何在文本视图中设置长文本,并在文本视图的末尾添加一个连续标记

[英]How to set long text in a textview with a continuation mark at the end of the textview

I have a textview with fixed height. 我有固定高度的textview。 I want to set a long text, but text comes at the last line getting cut by half, I want to avoid it and want to show a continuation symbol. 我想设置一个长文本,但文本在最后一行变成一半,我想避免它并显示一个连续符号。 I am giving an image here, I wan to achieve it like in the image. 我在这里给出一个图像,我想像图像中那样实现它。

在此处输入图片说明

Use the ellipsize attribute of TextView . 使用TextViewellipsize属性。 By setting : 通过设置 :

  <TextView
        ....
        android:ellipsize="end">
  </TextView>

if the text is longer than your TextView you will have dots( ... ) at the end of the TextView . 如果文本长于TextView ,则TextView的末尾将带有点( ... )。

Two line of string only possible to do like this. 两行字符串只能这样做。 set ellipsize = end in text view properties. 在文本视图属性中设置ellipsize = end。

您应该使用\\n和Google代码中的特殊符号。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM