1

I want to have ... at the beginning of a single-line text view..

<TextView
    android:id="@+id/dialer_display_number"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:textSize="@dimen/dialer_display_number_size"
    android:textColor="@color/white"
    android:includeFontPadding="false"
    android:maxLength="31"
    android:singleLine="true"
    android:ellipsize="start"
    android:background="@null"/>

However, it doesn't work and shows warning message

W/StaticLayout﹕ Start Ellipsis only supported with one line

I notice that if I remove singleLine="true", the warning will not appear.. but in any way, long text is not shortened with ... at the beginning

xialin
  • 7,686
  • 9
  • 35
  • 66

2 Answers2

0

Try to remove the property android:maxLength="31" from your TextView and check. As you have already defined the length of your TextView so it will filter your text for the given input.

GrIsHu
  • 29,068
  • 10
  • 64
  • 102
0

remove android:maxLength="31" and add android:maxEms="31".

it will solve your bug without any side-effects and changes.

Vivek Shah
  • 380
  • 2
  • 8