I have the following task:
There is string, and it may have any length: from 1 to 50 symbols. And there is TextView for storing this string.
I need to do the following thing:
if TextView can store this string without transferring to next line than TextView should store string, but if string is very large than TextView,the string should be appended with some chars “…” and shown in textview.
For example,if the string is “abdcdereweewew” and TextView can contain only 10 symbols on one line, then TextView should show “abdcder…”. How can I calculate it? Thank you in advance.
You can actually do this by setting the XML-attribute ellipsize on the actual TextView!
You should probably also set:
There are more options with ellipsize, have a look =)