End TextView with 3 dots with use of maxLength

前端 未结 11 882
北海茫月
北海茫月 2020-12-13 06:08

I have a TextView in my layout which is wrap_content in layout_width. It is limited to maximum of 15 characters so I\'m using maxLength.

I need to end this TextView

11条回答
  •  天涯浪人
    2020-12-13 06:27

    This will solve your problem, Use ellipsize Property in your XML Code

    android:ellipsize="end" 
    android:maxEms="15" 
    android:singleLine="true" 
    

    Edit: singleLine is deprecated. Use maxlines="1" instead.

提交回复
热议问题