Why OnOptionsMenuClosed not called on Android -
it necessary hide actionbar after exit menu. trap closing overriding onoptionsmenuclosed (menu menu) in activity. menu closed, method not invoked. , not when click "back" or when touch menu. how fix it?
this code in main.java:
@override public boolean oncreateoptionsmenu(menu menu) { super.oncreateoptionsmenu(menu); getmenuinflater().inflate(r.menu.menu_fomenu, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); if (id == r.id.default_lista_betoltese) { toast.maketext(getapplicationcontext(), "alaplista betöltése kész", toast.length_short) .show(); return true; } if (id == r.id.lista_betoltese) { toast.maketext(getapplicationcontext(), "mentett lista betöltése kész", toast.length_short) .show(); return true; } if (id == r.id.lista_mentese) { toast.maketext(getapplicationcontext(), "mentés kész", toast.length_short) .show(); return true; } if (id == r.id.szerkeszto_mod) { szerkeszto_mod(!szerkesztomod); return true; } if (id == r.id.betumeret_noveles) { betumeret++; toast.maketext(getapplicationcontext(), "betűméret: " + betumeret, toast.length_short) .show(); return true; } return super.onoptionsitemselected(item); } @override public void onoptionsmenuclosed (menu menu) { super.onoptionsmenuclosed(menu); getwindow().getdecorview().setsystemuivisibility( view.system_ui_flag_layout_hide_navigation | view.system_ui_flag_hide_navigation | view.system_ui_flag_immersive_sticky); }
use actionbar.onmenuvisibilitylistener receiving events when action bar menus shown or hidden.
http://developer.android.com/reference/android/app/actionbar.onmenuvisibilitylistener.html
Comments
Post a Comment