文本改变监听:
username为EditText的一个对象
username.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
//参数依次代表的意思:s文本内容,start从第几个字符开始改变,before(自己可以测试一下,我没测试),count改变的字符个数
// TODO Auto-generated method stub
Log.i("editText", s.toString());
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
Log.i("editText beforeTextChanged", s.toString());
}
@Override
public void afterTextChanged(Editable s) {
Log.i("editText afterTextChanged", s.toString());
// TODO Auto-generated method stub
}
});
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-05 22:43:07