我遇到的情况是会有两个EditText控件,一个用于输入税前税率值,另一个用于输入税后税率。我将同时更改BT和Rate AT值。当我更改“费率BT”时,“费率AT”文本应随“费率BT”而变化,反之亦然。
请帮助
答案 0 :(得分:1)
您只需将TextWatcher
添加到您的edittext中即可,
rateAtEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// you can do it here, what you want to do when RateAt text change
}
@Override
public void afterTextChanged(Editable s) {
}
});
rateBtEditText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// you can do it here, what you want to do when RateBt text change
}
@Override
public void afterTextChanged(Editable s) {
}
});