It seems to be the most weird thing that I've ever come across.
Here is a layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/GuessAppEditText"
android:lines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:inputType="textCapWords"
android:hint="@string/Hint" />
</RelativeLayout>
The hint
of EditText
is not shown.
If I remove either android:gravity="center_horizontal"
or android:inputType="textCapWords"
, hint becomes visible.
I have absolutely no idea what has gravity
and textCapWords
to do with hint
. Is it another Android bug or am I doing something wrong? In the former case, what would be a workaround? I want my text to be center-aligned and capitalized and hint to be shown. Or I want too much from poor Android?
Just add a single line and it will work, i.e android:ellipsize="start"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/GuessAppEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:ellipsize="start"
android:gravity="center_horizontal"
android:hint="hint"
android:inputType="textCapWords"
android:lines="1" />
</RelativeLayout>