EditText hint not showing in 5.0.1

自闭症网瘾萝莉.ら 提交于 2019-12-14 03:47:57

问题


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


回答1:


You need to give the hint a colour:

android:textColorHint="#000000"



回答2:


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



来源:https://stackoverflow.com/questions/27612140/edittext-hint-not-showing-in-5-0-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!