android - Hide SubMenu and SearchView in the Actionbar -
i trying hide both submenu , searchview in actionbar. using actionbarsherlock.
@override public boolean oncreateoptionsmenu(menu menu) { //used put dark icons on light action bar boolean islight = samplelist.theme == r.style.theme_sherlock_light; //create 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 hide submenu , searchview clicking button
btn_hide_menu.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { //here want hide both submenu , searchview
i can't sort out myself. possible? excuse me being naive.
try hope works
btn_hide_menu.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { //here want hide both submenu , searchview menuitem item = menu.finditem(r.id.my_item); item.setvisible(false); } }
Comments
Post a Comment