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?
The primary use of a TextInputLayout is to act as a wrapper for EditText(or its descendant) and enable floating hint animations. Rule of Thumb : TextInputLayout should wrap TextInputEditText instead of the normal EditText.
TextInputLayout is a view container that is used to add more features to an EditText. It acts as a wrapper for EditText and has some features like: Floating hint. Animation that can be disabled or enabled. Error labels that display error messages when an error occurs.
using android:ellipsize="end"
fixed it for me
Weird bug !! (but Android has a lot of these weirdo bug)
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"
.
You need to give text color to hint
android:textColorHint="#000000"
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