Android: Textview Automatically Truncate and Replace Last 3 Char of String

Android: TextView automatically truncate and replace last 3 char of String

You should be able to use the "ellipsize" property of a text view:

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/text_mytext"
android:ellipsize="end"
android:maxLines="1"
/>

You may also need to apply gravity values to the layout too; I have sometimes seen "auto-stretching" views without them.

Android: Something better than android:ellipsize=end to add ... to truncated long Strings?

See my update 3. The workaround was using " marquee". I have seen many apps doing that at this time.
Now, with new versions of Android this feature is most likely fixed and will work as expected. (my guess)

Adding '...' at end of a string in android in TextViews

Add these attributes to your TextView to restrict your TextView's text in one line and to add 3 dots ... at the end of line.

android:singleLine="true"
android:ellipsize="end"

TextView setText problem

Try adding this to your TextView (marquee or end):

android:ellipsize="marquee"

You may also need:

android:scrollHorizontally="true"

Without scrollHorizontally="true" you may still get the text wrapped rather than appended with ... I use these very 2 lines to display a list view in my app. The 3 long lines I have get appended correctly.



Related Topics



Leave a reply



Submit