Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android EditText background text

Is there a way to set the background text of an EditText? for instance, I have a login screen with 2 EditText views, one for username and one for password. I want the text "Username" and "Password" be written inside the EditText, and once the user touches those the text disappears but once user deleted his own entry, text re-appears.

Is there a property for that or should I implement this on my own with events and stuff?

like image 482
oriharel Avatar asked Dec 20 '10 12:12

oriharel


2 Answers

The hint property will take care of that for you.

like image 50
Blrfl Avatar answered Nov 07 '22 20:11

Blrfl


Use hint property, or setHint method.

like image 37
Marek Gocał Avatar answered Nov 07 '22 19:11

Marek Gocał