Skip to main content

android ellipsize multiline textview ?

android ellipsize multiline textview ?

A1. XML

       android:maxLines="2"
    android:ellipsize="end"
    android:singleLine="false"

A2.

       Try this, it works for me, I have 4 lines and it adds the "..." to the end of the last/fourth line.        Its  the same as morale's answer but i have singeLine="false" in there.

    <TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:maxLines="4" 
    android:ellipsize="marquee" 
    android:singleLine="false" 
    android:text="Hi make this a very long string that wraps at least 4 lines, seriously make it really 

A3.

       There are a few attributes you should check: android:lines, android:minLines,                             android:maxLines. To display a maximum of 4 lines and ellipsize it, you just need                         android:maxLines and android:ellipsize:


<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:maxLines="4"
    android:ellipsize="marquee"
    android:text="Hai!"
    />


Comments