我需要一个带有固定后缀的EditText。我正在使用TextWatcher来捕获onTextChanged事件,但是如果我通过添加后缀再次更改文本,它会导致堆栈溢出异常,从而引发无限递归。
msgtextview.addTextChangedListener(new TextWatcher() {
public void afterTextChanged(Editable s) {
//Doing some other stuff
msgtextview.setText("Changed Text") //This cause infinite recursion
}
}
这里是代码。