本文介紹了Android listview edittext過濾空間按鈕?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我創建了一個過濾器列表視圖,用戶將通過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過濾空間按鈕?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!