My EditText
configured as follows won\'t show the hint:
I changed the style to "@style/Base.WidgetMaterialComponents.TextImputEditText"
. For me it wasn't gravity or color.
Using android:ellipsize="end" resolves the obvious platform bug. Unfortunately, Xperias still misbehave :(
I found no other solution than to:
if (android.os.Build.MANUFACTURER.matches(".*[Ss]ony.*"))
editText.setGravity(Gravity.LEFT);
else
editText.setGravity(Gravity.CENTER);
The below worked for me:
<EditText
android:id="@+id/UserText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/UserPassword"
android:layout_marginTop="85dp"
android:ems="10"
android:hint="@string/UserHint"
android:inputType="textPersonName"
android:singleLine="true"
android:text="@string/UserName" >
<requestFocus />
</EditText>
Try changing the hint text color, sometimes the hint color is the same as the background color
android:textColorHint="@color/colorBlack"
In Lollipop version the default text and hint text color is white for EditText
.
So we have to change like this in EditText
android:textColorHint="@color/grey"
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"
.