android – Custom Position of Hint in Edit Text box.-ThrowExceptions

Exception or error:

I was wondering if there was any way that I could get a hint at the bottom of an Edit Text view — and then the user to start entering text at the top of the box.

As a bonus question, is there any way I can make the hint NOT disappear once the user starts entering text.

How to solve:

You can set the position of the text using the “gravity” attribute (as noted at So to put the text at the bottom you would have;


And to answer your bonus question; No, you can’t display the hint when text is entered into the edit text view. Displaying the hint only when the box is empty is the defined behaviour as noted at

(and yes, I know the links are for TextView, but EditText derives all of its’ text positioning and hint handling functionality from TextView).


Actually THERE IS a way to prevent hint from hiding, and it’s a cool one 🙂

It gives you the Floating Label look with smooth animation very easily and it’s from android itself. No extra libraries and stuff.

Try this:

                android:hint="Touch me and I'll fly!"/>

You can change the behaviour using other xml tags like android:gravity="start|center|end" and others.

As a BONUS, you can use error messages with it 🙂 Here’s the link to that question:

And sorry I do not have enough reputatuion to post images, so help yourself:

Enjoy 🙂


The problem with using both android:gravity and android:hint is that they are inter-linked with regard to cursor position.When you position the hint using gravity and you start entering text, it is entered in the same position as the your hint which is a problem if you want it to start traditionally on the top-left corner.

Leave a Reply

Your email address will not be published. Required fields are marked *