Android EditText background text

2019-02-04 08:57发布

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?

2条回答
家丑人穷心不美
2楼-- · 2019-02-04 09:12

Use hint property, or setHint method.

查看更多
趁早两清
3楼-- · 2019-02-04 09:31

The hint property will take care of that for you.

查看更多
登录 后发表回答