views:

29

answers:

1

Hi!

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 title (X)
Element with a very lo...(X)

The title should be ellipsized, but the X must be always visible. In my case, is not possible to use more than one TextView. Do you think there is a simple way of doing this?

Thanks!

+1  A: 

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

Ryan Conrad
Thanks for your answer! It is not a bad solution indeed, but is not exactly what I was looking for...
Antonio
Anything beyond this, you will have to create your own checks and draw it yourself with the ellipsis where you want it.
Ryan Conrad