I am trying to hide both the SubMenu and the SearchView in the ActionBar. I am using ActionBarSherlock.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//Used to put dark icons on light action bar
boolean isLight = SampleList.THEME == R.style.Theme_Sherlock_Light;
//Create the search view
SearchView searchView = new SearchView(getSupportActionBar().getThemedContext());
searchView.setQueryHint("Zong ol na...");
searchView.setOnQueryTextListener(this);
searchView.setOnSuggestionListener(this);
searchView.setSuggestionsAdapter(mSuggestionsAdapter);
SubMenu sub = menu.addSubMenu("Menu");
sub.add(0, R.style.Theme_Sherlock, 0, "Topic");
sub.add(0, R.style.Theme_Sherlock_Light, 0, "Thuthlunghlui");
sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
menu.add("Search")
.setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.abs__ic_search)
.setActionView(searchView)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
I want to hide SubMenu and SearchView by clicking the button
Btn_Hide_Menu.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{ //here I want to hide both the SubMenu and SearchView
I can't sort it out myself. Is this possible? Excuse me I am being too naive.