输入0-9 .
mEditText.setKeyListener(new NumberKeyListener() { @Override protected char[] getAcceptedChars() { char[] chars = {‘0‘, ‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘, ‘6‘, ‘7‘, ‘8‘, ‘9‘, ‘.‘}; return chars; } @Override public int getInputType() { return InputType.TYPE_CLASS_NUMBER; } });
原文:http://www.cnblogs.com/teddy-yan/p/6434572.html