Home > front end >  Android : how to shorten string in textview
Android : how to shorten string in textview

Time:03-16

I want to shorten this string, for example it shows only 4 characters, and the rest becomes ...

String a = "Jhonatan Smith";

can it be like this? results :

Jhon...

is there any solution for this?

CodePudding user response:

If it is a TextView you can use setEllipsize so words in the text that are longer than the view's width to be ellipsized instead of broken in the middle.

  • Related