我创建了一个过滤器列表视图,用户将通过edittext输入输入,结果在列表视图中进行过滤.
I have created a filter listview where user will enter input via edittext and results are filtered in the listview.
代码运行良好,但是当我按下空格按钮时,列表视图的结果会消失.如何在不关闭列表视图内容的情况下在搜索输入中添加空格??
The code is running good but when ever i press Space button, results in the list view disappears. how can i add space in search input without dismissing the listview contents ??
这是我当前的代码:
myListview.setTextFilterEnabled(true);
edNearBy.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
}
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
NearByActivity.this.aa.getFilter().filter(s);
}
});
这样做:
public void afterTextChanged(Editable s) {
String st = s.toString().trim();
NearByActivity.this.aa.getFilter().filter(st);
}
但不要这样过滤,这是正确的.
这篇关于Android listview edittext过滤空间按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!