Я реализовал SearchView Android на панели действий для поиска в списке, все работает нормально, но запрошенный текст в SearchView отображается, как показано ниже
это код, который я написал
searchView.setQueryHint("Query Hint");
searchView.setIconifiedByDefault(true);
searchView.setOnQueryTextListener(this);
Кто-нибудь, пожалуйста, помогите мне, как удалить это представление
Это код, относящийся к представлению поиска.
public class HomeScreen extends Activity implements SearchView.OnQueryTextListener{
....
OnCreate(){
...
listView.setAdapter(adapter);
listView.setTextFilterEnabled(true);
}
OnCreateOptionsMenu()
{...
setUpSearchView();
...}
private void setupSearchView() {
searchView.setQueryHint("Search Product");
searchView.setIconifiedByDefault(true);
searchView.setOnQueryTextListener(this);
}
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (TextUtils.isEmpty(newText)) {
listView.clearTextFilter();
} else {
listView.setFilterText(newText);
}
return true;
}
Код адаптера приведен ниже.
public class CustomListAdapter extends BaseAdapter implements Filterable{
private Activity activity;
private List<Product> productItems;
private List<Product> orig;
public CustomListAdapter(Activity activity, List<Product> productItems) {
this.activity = activity;
this.productItems = productItems;
}
@Override
public int getCount() {
return productItems.size();
}
@Override
public Object getItem(int location) {
return productItems.get(location);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ProductHolder productHolder;
....
return convertView;
}
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
final FilterResults filterResults = new FilterResults();
final List<Product> intermediateResults = new ArrayList<Product>();
if(orig == null)
orig = productItems;
if(constraint != null)
{
if(orig!=null && orig.size() > 0){
for (final Product g : orig) {
if (g.getTitle().toLowerCase().contains(constraint.toString()))
intermediateResults.add(g);
}
}
filterResults.values = intermediateResults;
}
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
productItems = (ArrayList<Product>) results.values;
notifyDataSetChanged();
}
};
}
}
lv.setTextFilterEnabled(true)
или что-то подобное ... если вы используете SearchView, нет необходимости устанавливать это - person Selvin   schedule 11.05.2015