How can I change dots to commas/stars when using ellipsize (textview) in Android?
Example with dots: Lorem Ipsum is simply dum...
Example with stars: Lorem Ipsum is simply dum***
How can I change dots to commas/stars when using ellipsize (textview) in Android?
Example with dots: Lorem Ipsum is simply dum...
Example with stars: Lorem Ipsum is simply dum***
You cannot. The ellipsis strings are hardcoded in the platform TextUtils
and StaticLayout
is where ellipsizing happens. Obtaining the text content from a TextView
does not come with the ellipsis chars in place.
In theory you could cook up your own ellipsizer that modifies the string to truncate the way you want before passing it to TextView
.
You can use this library by TheCodeYard
. You can use all the ellipse types with a custom ellipse text. This is a sample image of that library: