How to set maxLines and ellipsesize of a TextView at the same time.

Posted by michael on Stack Overflow See other posts from Stack Overflow or by michael
Published on 2010-05-26T00:22:24Z Indexed on 2010/05/26 0:31 UTC
Read the original article Hit count: 221

Filed under:

I want to limit my text view to have maximum of 6 lines, so I did:

<TextView
    android:id="@+id/toptext" android:layout_width="fill_parent"
    android:layout_height="wrap_content"  
    android:maxLines="6"/>

But when I try to configure it to add '...' when the text is truncated, I add android:ellipsize="end". I do see the ... but then my TextView only has a max line of 2, instead of 6.

Can you please how can I make the text view of maximum line of 6 and add '...' when it get truncated?

Thank you.

© Stack Overflow or respective owner

Related posts about android