EditText hint not showing in 5.0.1

2019-06-26 03:00发布

I have the latest 5.0.1 update and the EditText hint has stopped showing:

I have:

<EditText
     android:id="@+id/editTextLocation"
     android:layout_width="wrap_content"
     android:layout_marginEnd="5dp"
     android:layout_marginLeft="5dp"
     android:layout_marginRight="5dp"
     android:layout_marginStart="5dp"
     android:layout_weight="80"
     android:clickable="false"
     android:focusable="false"
     android:focusableInTouchMode="false"
     android:hint="@string/chooseLocationHint"
     android:longClickable="false"
     android:textColor="#000000"
     android:textSize="15sp"
     android:background="@color/white"
     android:lines="1"
/>

I've looked through a few "solutions" but they're all quite old and unrelated to 5.0.1

Thanks

2条回答
Juvenile、少年°
2楼-- · 2019-06-26 03:18

Oddly enough the hint won't display when the EditText doesn't have focus unless the ellipse size is defined (e.g. ellipsize="end")

查看更多
我只想做你的唯一
3楼-- · 2019-06-26 03:37

You need to give the hint a colour:

android:textColorHint="#000000"
查看更多
登录 后发表回答