androidlines

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


Solution

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