0

I have something like a message system and listview that hold the messages.So I want to show let's say only the first 10 symbols of the message and after ellipsis.I couldn't find information how to do it, so if somebody can help me.

emili
  • 9
  • 1
  • Does this answer do what you want? http://stackoverflow.com/questions/6768977/text-does-not-ellipsize – Sparky Oct 07 '14 at 14:33

1 Answers1

0

I assume you know how to set up an adapter.

You can achieve that by editing your XML layout file. You limit the max amount of text your TextView can hold, and tell it to add ellipsis if it's longer.

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

Example from here

Community
  • 1
  • 1
Marius
  • 810
  • 7
  • 20
  • This is my xml, maxLenth is working but ellipsize="end" is not working, is not adding ellipsis.Any idea why?Sorry I dont know how to format the code that's why I wrote it and as a answer. – emili Oct 07 '14 at 15:27