Android EditText限制输入 ,只输入数字

EditText

bytesPicker.setKeyListener(new NumberKeyListener() {
                protected char[] getAcceptedChars() {
                    return new char [] {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
                            ',', '.'};
                }
                public int getInputType() {
                    return EditorInfo.TYPE_CLASS_NUMBER | EditorInfo.TYPE_NUMBER_FLAG_DECIMAL;
                }
            });

猜你喜欢

转载自blog.csdn.net/zengxx1989/article/details/135116025
今日推荐