/** * 禁止EditText输入空格 * * @param editText */ public static void setEditTextInhibitInputSpace(EditText editText) { InputFilter filter = new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { if (source.equals(" ")) { return ""; } else { return null; } } }; editText.setFilters(new InputFilter[]{filter}); }
禁止EditText输入空格
最新推荐文章于 2021-05-29 00:16:49 发布