mEditText.setKeyListener(new NumberKeyListener() {
@Override
public int getInputType() {
// TODO Auto-generated method stub
return 3;// 默认使用数字键盘
}
@Override
protected char[] getAcceptedChars() {
// TODO Auto-generated method stub
char key[] = new char[] { '1', '2', '3', '4', '5', '6','7', '8', '9', '0', 'X' };
return key;
}
});
EditText默认输入数字,且只能输入指定字符
最新推荐文章于 2023-12-20 19:39:52 发布