对EditText监听,按钮点击

发布于:2021-06-14 16:58:46

1


etBarCode.addTextChangedListener(watcher);

2


private TextWatcher watcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
if (editable.length() == 0) {
btnConfirm.setEnabled(false);
} else {
btnConfirm.setEnabled(true);
}
}
};

转载于:https://www.cnblogs.com/520-1314/p/5562828.html

相关推荐

最新更新

猜你喜欢