street = (EditText) findViewById(R.id.street);
InputFilter filter = new InputFilter() {
public CharSequence filter(CharSequence source, int start, int end,Spanned dest, int dstart, int dend) {
for (int i = start; i < end; i++) {
if (!Character.isLetterOrDigit(source.charAt(i)) || !Character.isSpaceChar(source.charAt(i))) {
return "";
}
}
return null;
}
};
street.setFilters(new InputFilter[] { filter });
我的edittext能够过滤虚拟键盘上的字符和数字但不占用空格字符..请帮助