Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Something better than android:ellipsize="end" to add "..." to truncated long Strings?
    primarykey
    data
    text
    <p><a href="https://stackoverflow.com/questions/1666736/android-textview-automatically-truncate-and-replace-last-3-char-of-string">This property</a> makes </p> <blockquote> <p>"short and very-long-word"</p> </blockquote> <p>to </p> <blockquote> <p>"short and"</p> </blockquote> <p>. But I want to have smth. like </p> <blockquote> <p>"short and very-lon..."</p> </blockquote> <p>Right now I truncate the String in Java code. However, thats based on the number of characters and not the actual length of the link. So, the result isn't very nice.</p> <pre><code>String title; if(model.getOrganization().length() &gt; 19) { title = model.getText().substring(0, 15).trim() + "…"; } else { title = model.getText(); } ((TextView) findViewById(R.id.TextViewTitle)).setText(title); </code></pre> <p><strong>Update</strong></p> <p>Just noticed, this property actually adds "..." in a few cases. But not in all of them:</p> <blockquote> <p>12345678901234567890 becomes "12345678901234..."</p> </blockquote> <p>However, </p> <blockquote> <p>"1234567890 1234567890" becomes "1234567890" and not "1234567890 123..."</p> </blockquote> <p><strong>Update 2</strong></p> <p>Now it really gets funky! I just set singleLine=true and removed maxLine (The bug appears with and without setting ellipsize attribute)...</p> <p><img src="https://i.stack.imgur.com/OAIfX.png" alt="alt text"></p> <p>This is a screenshot take from Motorola Milestone with android 2.1 update 1. Same happens on HTC Desire with the same android version</p> <p><strong>Update 3</strong></p> <p>Now I use android:ellipsize="marquee". That seems to be the only properly working setting. It's also only moving, when focused. I see it in many other apps also. I guess its common practise.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload