在点击清除的EditText [英] Clear EditText on click
本文介绍了在点击清除的EditText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在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().
这篇关于在点击清除的EditText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文