androidtextview

TextView should be displayed with ... character at the end


I have created a textview with the below code:

<TextView 
    android:id="@+id/txtDescription" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:textSize="16dip"
    android:textStyle="bold"
    android:maxLines="5">

As above, I have set the 5 lines as maximum for the textview.

But my doubt is: if the string which I am going to display in Textview if it exceeds 5 lines, then it will be fitted up to 5 lines ending with "..." characters.

e.g.

Hello this is the demo of 
string which i have 
created especially for
the demo of textview
and setting maximum...

As same as above, I want to display in TextView output. How can I solve this issue?


Solution

  • Just use android:ellipsize.