List of usage examples for android.widget SearchView isIconified
public boolean isIconified()
From source file:com.paranoid.gerrit.GerritControllerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.gerrit_instances_menu, menu); this.mMenu = menu; // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(true); // Let the change list fragment handle queries directly. searchView.setOnQueryTextListener(mChangeList); searchView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { @Override/*from w ww . java 2 s. co m*/ public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { SearchView view = (SearchView) v; if (view.isIconified()) { mMenu.findItem(R.id.menu_team_instance).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mMenu.findItem(R.id.menu_projects).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } else { mMenu.findItem(R.id.menu_team_instance).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mMenu.findItem(R.id.menu_projects).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } } }); setupSearchQuery(); return true; }