I create a DrawerLayout
and it have a EditText
above of ListView
for search on ListView
. How i can active search on DrawerLayout
now ?
Asked
Active
Viewed 42 times
0

A.A
- 1,138
- 1
- 16
- 29
-
you mean search using Edittext from ListView? – Rod_Algonquin Jun 16 '14 at 06:01
-
Yes. I insert a EditText on DrawerLayout for search on DrawerLayout. – A.A Jun 16 '14 at 06:09
-
Did you try anything? Please show that. You can go with implementing onTextChanged listener. – MysticMagicϡ Jun 16 '14 at 06:10
1 Answers
1
This is working fine for me:
In xml, include an edittext just above the listview:
<EditText
android:inputType="text"
android:id="@+id/searchTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
/>
In java file:
mSearchText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
adapter.getFilter().filter(s);
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
Here mSearchText
is the searchTxt
from xml file and adapter
will be the adapter of your navigation drawer listview.
Hope it helps.

MysticMagicϡ
- 28,593
- 16
- 73
- 124