EditText提示文本在5.0.1中无法显示。

4
我已经更新到最新的5.0.1版本,但EditText的提示文字未显示出来:
我有:
<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"
/>

我已经浏览了几个“解决方案”,但它们都很旧,并且与5.0.1无关。
谢谢。

我将你的XML放入一个新的抓取项目中,它可以正常工作。 - CommonsWare
2个回答

10

你需要给提示添加一个颜色:

android:textColorHint="#000000"

0

奇怪的是,如果未定义省略号大小(例如ellipsize="end"),当EditText没有焦点时,提示不会显示。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接