android - Hide/unhide toolbar menu -
i want can able hide/unhide programmatically toolbar menu.
because couldn't find information on net use next code remove menu toolbar:
toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar); mtoolbar.getmenu().clear();
how can put programmatically?
i figure out next code hide menu:
toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar); mtoolbar.getmenu().clear();
and next unhide:
toolbar mtoolbar = (toolbar) findviewbyid(r.id.toolbar); if (!mtoolbar.getmenu().hasvisibleitems()) { getmenuinflater().inflate(r.menu.menu_activity, mtoolbar.getmenu()); }
Comments
Post a Comment