Guy Cothal
Guy Cothal

Reputation: 1348

android - android:maxLines="3" cuts off at 2

Here is my view

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:text="@string/textView1"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:ellipsize="end"
        android:maxLines="3"
        android:textColor="#ffffffff"
        android:background="#ff000000" 
        android:gravity="center"/>

The maxLines makes enough room for 3 lines...even if you do the following

//Needed code to cast TextView omitted for simplicity
txtView.setLines(3);
//and
txtView.setMaxLines(3);

They still have the same issue

Upvotes: 0

Views: 1998

Answers (2)

Yury
Yury

Reputation: 20936

It's a known bug. See details and how to solve it here.

Upvotes: 1

Vinay W
Vinay W

Reputation: 10190

adding a android:lines="3" attribute works copying a working code from eclipse:

<TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:ellipsize="end"
        android:maxLines="3"
        android:textColor="#ffffffff"
        android:background="#ff000000" 
        android:gravity="center"  android:lines="3"/>

Upvotes: 1

Related Questions