How can I show ellipses on my TextView if it is greater than the 1 line?

后端 未结 7 1312
终归单人心
终归单人心 2020-11-30 22:19

I have the following Layout which does not work:



        
7条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 22:37

    So all the answers above cater to the requirement that only 1 line and then the ellipsis should appear. However if you want the ellipsis to appear after certain lines of text, then you should use the following:

    android:ellipsize="end"
    android:maxLines="2"
    android:singleLine="false"
    

    With this the ellipsis will appear only after 2 lines. Note: Its important to have singleLine as false.

提交回复
热议问题