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?
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 keepinggravity="right"
, and settingsingleLine="true"
andellipsize="end"
.Using android:ellipsize="end" resolves the obvious platform bug. Unfortunately, Xperias still misbehave :(
I found no other solution than to:
The below worked for me:
No need of
android:scrollHorizontally
attribute. Remove it.EditText
is a fixed item on the screen. we want scroll the layout contains the EditText is enough. that is the best design too. you have putandroid:ellipsize="end"
instead ofandroid:scrollHorizontally
.In Lollipop version the default text and hint text color is white for
EditText
. So we have to change like this inEditText
This is how, I did for by
EditText
to have hint in it.