Android EditView 保留1位小数

                        @Override
			public void afterTextChanged(Editable s) {
				// TODO Auto-generated method stub
				String temp = s.toString();
				int posDot = temp.indexOf(".");
				if (posDot <= 0)
					return;
				if (temp.length() - posDot - 1 > 1) {
					s.delete(posDot + 2, posDot + 3);
				}
			}

你可能感兴趣的:(Android EditView 保留1位小数)