Android的列表视图的EditText过滤器空间按钮? [英] Android listview edittext filter space button?
本文介绍了Android的列表视图的EditText过滤器空间按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个筛选器列表视图,其中用户将通过进入的EditText输入和结果进行过滤的列表视图。
在code运行良好,但是当我过preSS空间按钮,结果在列表视图中消失。我如何添加在搜索输入空间,而不驳回列表视图内容??
下面是我目前的code:
myListview.setTextFilterEnabled(真正的);
edNearBy.addTextChangedListener(新TextWatcher(){
公共无效onTextChanged(CharSequence中,诠释开始,诠释之前,诠释计数){
// TODO自动生成方法存根
}
公共无效beforeTextChanged(CharSequence中,诠释开始,诠释计数,
之后INT){
// TODO自动生成方法存根
}
公共无效afterTextChanged(编辑S){
// TODO自动生成方法存根
。NearByActivity.this.aa.getFilter()过滤器(S);
}
});
解决方案
做的是这样的:
公共无效afterTextChanged(编辑S){
串ST = s.toString()修剪()。
。NearByActivity.this.aa.getFilter()过滤器(ST);
}
但不要做过滤这种方式,在这里是正确的。
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 ??
Here is my current code :
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);
}
});
解决方案
do this way:
public void afterTextChanged(Editable s) {
String st = s.toString().trim();
NearByActivity.this.aa.getFilter().filter(st);
}
but don't do filtering this way, here is the correct one.
这篇关于Android的列表视图的EditText过滤器空间按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文