example to what kind of problem I am running into.
Let say I have 6 elements in a listview all in order from left to right [1,2,3,51,4,5].
When I search for 5 it displays "51" and "5". When I click on "51" it opens up "1". The problem is that the filtered list overlaps the listview that displays all the elements. I was wondering how I can fix this issue. I am using v7.widget.SearchView
@Override
public void onCreateOptionsMenu(final Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.recipe_menu, menu);
SearchView searchView = (SearchView) menu.findItem(R.id.search_recipe).getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (TextUtils.isEmpty(newText)) {
lv.clearTextFilter();
} else {
lv.setFilterText(newText.toString());
}
return true;
}
});
super.onCreateOptionsMenu(menu, inflater);
}
Aucun commentaire:
Enregistrer un commentaire