Ellipsize only a section in a TextView

前端 未结 2 397
予麋鹿
予麋鹿 2021-01-05 10:28

I was wondering if it is possible to abbreviate only a portion of a string in a TextView. What I would like to do is something like this:

Element with short          


        
2条回答
  •  时光说笑
    2021-01-05 10:48

    You can try using something like this:

    myTextView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
    

    It might not give you exactly what you want though, it may do something like this:

    Element wi...title (X)

    Reference Info

    TruncateAt
    setEllipsize

提交回复
热议问题