1.EditText禁止输空格 editText.setFilters(new InputFilter[]{filter}); private InputFilter filter=new InputFilter() { @Override public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) { //返回null表示接收输入的字符,返回空字符