我有一个称为“文本”的EditView。
我已经实现了textWatcher
text.addTextChangedListener(this);
每当我尝试将EditView设置为TextWatcher中的某个值时,都会将其强制关闭。
这是代码:
public void beforeTextChanged(CharSequence s, int start, int count,int after)
{
}
public void onTextChanged(CharSequence s, int start, int before, int end)
{
//text.setText("");
}
public void afterTextChanged(Editable s)
{
//text.setText("");
}
我的要求是:每当用户键入一些值时,EditView都必须设置回Null。
请帮帮我。
最佳答案
您可以这样操作:
public void beforeTextChanged(CharSequence s, int start, int count,int after) {
}
public void onTextChanged(CharSequence s, int start, int before, int end) {
}
public void afterTextChanged(Editable s){
s.clear();
}