Hesam Hesam - 4 months ago 161
Android Question

Android, How to limit width of TextView (and add three dots at the end of text)?

I have a

TextView
that I want to limit characters of it. Actually, I can do this but the thing that I'm looking for is how to add three dots (...) at the end of string. This one shows the text has continue. This is my XML but there is no dots although it limit my text.

<TextView
android:id = "@+id/tvFixture"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_toLeftOf = "@id/ivFixture_Guest"
android:text = "@string/test_06"
android:lines = "1"
android:ems = "3"
android:gravity = "right"
style = "@style/simpletopic.black"
android:ellipsize="end"/>

Answer

Deprecated:

Add one more property android:singleLine="true" in your Textview

Updated:

android:ellipsize="end" 
android:maxLines="1"