本文介绍了Android listview edittext过滤空间按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我创建了一个过滤器列表视图,用户将通过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过滤空间按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)