标签:rac size put else har tostring als article 字符串表
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表示接收输入的字符,返回空字符串表示不接受输入的字符
if(source.equals(" "))return ""; else return null; }};
2.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) { if(source.equals(" ")||source.toString().contentEquals("\n"))return ""; else return null; } };
标签:rac size put else har tostring als article 字符串表
原文地址:http://www.cnblogs.com/yangykaifa/p/7308895.html