解决方法
在您的onQueryTextChange(String Text)方法中使用Listener:
.adapter.getFilter()滤波器(Text.toString());并在BaseAdapter类中实现您的过滤器.
这是示例代码:
.adapter.getFilter()滤波器(Text.toString());并在BaseAdapter类中实现您的过滤器.
这是示例代码:
@Override public Filter getFilter() { return filter; } private GameFilter filter; private class GameFilter extends Filter { public GameFilter() { } @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults oReturn = new FilterResults(); ArrayList<ItemDetails> results = new ArrayList<ItemDetails>(); if (orig == null) orig = itemDetailsrrayList; if (constraint != null) { if (orig != null && orig.size() > 0) { for (ItemDetails g : orig) { if (g.getName().toLowerCase().contains(constraint.toString().toLowerCase())) results.add(g); } } oReturn.values = results; } return oReturn; } @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint,FilterResults results) { itemDetailsrrayList = (ArrayList<ItemDetails>)results.values; notifyDataSetChanged(); } }