EditText hint doesn't show

Viewed 37182

My EditText configured as follows won't show the hint:

<EditText
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="right"
    android:hint="The hint..."
    android:scrollHorizontally="true"
    android:singleLine="true" />

It works if I set android:gravity="left" or if I remove android:scrollHorizontally and android:singleLine attributes, which is not desirable. Any suggestions?

10 Answers

I wanted my single-line EditText box to scroll but keep the hint on the right also. I had the same issue and got the hint to stick by keeping gravity="right", and setting singleLine="true" and ellipsize="end".

Try changing the hint text color, sometimes the hint color is the same as the background color

android:textColorHint="@color/colorBlack"

I changed the style to "@style/Base.WidgetMaterialComponents.TextImputEditText". For me it wasn't gravity or color.

Related