由网友(喵咕酱)分享简介:在Android的我怎样才能使一个的EditText 明确时,它的点击?In Android how can I make an EditText clear when it's clicked?也就是说,如果我有一个的EditText 在某些字符,如输入名称,用户在点击它,这些字消失了。ie if I have...
在Android的我怎样才能使一个的EditText
明确时,它的点击?
In Android how can I make an EditText
clear when it's clicked?
也就是说,如果我有一个的EditText
在某些字符,如输入名称
,用户在点击它,这些字消失了。
ie if I have an EditText
with some characters in, such as 'Enter Name'
, when the user clicks on it these characters disappear.
干杯
推荐答案
我不知道,如果你是在此之后,但尝试这个XML:
I'm not sure if you are after this, but try this XML:
android:hint="Enter Name"
它显示文本时输入字段为空,选择或不选择。
It displays that text when the input field is empty, selected or unselected.
或者,如果你想要它做的正是像你描述的,分配onClickListener在EDITTEXT,并将其设置为空用的setText()。
Or if you want it to do exactly as you described, assign a onClickListener on the editText and set it empty with setText().
相关推荐
最新文章