TextWatcher tw = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
Log.e("beforeTextChanged", "-----------------------");
Log.e("beforeTextChanged", "s:" + s + " start:" + start + " count:"
+ count + " after:" + after);
// s:之前的文字内容
// start:添加文字的位置(从0开始)
// count:不知道 一直是0
// after:添加的文字总数
}
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
Log.e("onTextChanged", "-----------------------");
Log.e("onTextChanged", "s:" + s + " start:" + start + " before:"
+ before + " count:" + count);
// s:之后的文字内容
// start:添加文字的位置(从0开始)
// before:不知道 一直是0
// before:添加的文字总数
}
@Override
public void afterTextChanged(Editable s) {
Log.e("afterTextChanged", "-----------------------");
Log.e("afterTextChanged", "s:" + s);
// s:之后的文字内容
}
};
tv.addTextChangedListener(tw);