EditText默认输入数字,且只能输入指定字符

来源:互联网 发布:社交软件介绍 编辑:程序博客网 时间:2024/06/11 03:43
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;                }            });
0 0
原创粉丝点击