当按钮删除键盘持续为真时,如何在settext编辑文本后继续从编辑文本中删除字符?
edtDesc.addTextChangedListener(new TextWatcher() {
String formatNumber = "";
@Override
public void afterTextChanged(Editable s) {
edtDesc.setSelection(edtDesc.getText().length());
}
@Override
public void beforeTextChanged(CharSequence s, int arg1, int arg2, int arg3) {
}
@Override
public void onTextChanged(CharSequence s, int arg1, int arg2, int arg3) {
if (s.length() != 0) {
edtDesc.setText(edtDesc.getText().toString().replace("A", "B"));
isSelectTozihat = true;
}
}
});
感谢
答案 0 :(得分:0)
edtDesc.addTextChangedListener(new TextWatcher() {
String formatNumber = "";
@Override
public void afterTextChanged(Editable s) {
edtDesc.setSelection(edtDesc.getText().length());
}
@Override
public void beforeTextChanged(CharSequence s, int arg1, int arg2, int arg3) {
}
@Override
public void onTextChanged(CharSequence s, int arg1, int arg2, int arg3) {
if ((s.length() != 0)&&(edtDesc.getText().toString().contains("A")) {
edtDesc.setText(edtDesc.getText().toString().replace("A", "B"));
isSelectTozihat = true;
}
}
});