bandCardNum.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence pCharSequence, int pI, int pI1, int pI2) {
}
@Override
public void onTextChanged(CharSequence pCharSequence, int pI, int pI1, int pI2) {
// 键盘输入时的监听
}
@Override
public void afterTextChanged(Editable pEditable) {
}
});
//键盘弹出时点击键盘上的回车键跳到下一个输入框
etPhone.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence pCharSequence, int pI, int pI1, int pI2) {
}
@Override
public void onTextChanged(CharSequence pCharSequence, int pI, int pI1, int pI2) {
}
@Override
public void afterTextChanged(Editable pEditable) {
String str = pEditable.toString();
if (str.indexOf("\r")>=0 || str.indexOf("\n")>=0){//发现输入回车符或换行符
etPhone.setText(str.replace("\r","").replace("\n",""));//去掉回车符和换行符
etVerify.requestFocus();//让editText2获取焦点
etVerify.setSelection(etVerify.getText().length());//若editText2有内容就将光标移动到文本末尾
}
}
});