editText.addTextChangedListener(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 (editText.length() > 0) {
editText.setBackgroundColor(Color.BLUE);
} else {
editText.setBackgroundColor(Color.RED);
}
}
});
edtext的实时监听
最新推荐文章于 2019-01-15 11:02:12 发布