我有 8 个编辑文本,每个文本只允许一个字符。当用户输入内容时,它会自动移动到下一个编辑文本。使用 onTextchanged 可以正常工作。但是我也需要向后移动,就像用户输入后退按钮时它会自动移动到上一个编辑文本,当输入内容时它会再次移动下一个编辑文本。我该怎么做。请任何人帮忙。
任何帮助将不胜感激。
editText_Pin1.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start,int before, int count) {
if(editText_Pin1.getText().toString().length()==1) { //size as per your requirement {
editText_Pin2.requestFocus();
}
}
public void beforeTextChanged(CharSequence s, int start,int count, int after) {
}
@Override
public void afterTextChanged(Editable arg0) {
}
});