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?
it's 2021 and this still seems to be an issue, so for anyone running trying to use an EditText and not seeing the hint in the designer you can add tools:background="@android:color/transparent"
or assign any color to the background and the hint will appear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With