I have a custom dialog and use it instead of the options menu so that's why I want to behave like a dialeau menu , I.e. show / hide the menu on the press. I have tried many forms, but there was only one result:
As I have set an online listener for my diallie
myDialog.setOnKeyListener (New OnKeyListener () {@Override public boolean Onkey (DialogInterface arg0, int arg1, keyEvent arg2) {if (arg1 == KeyEvent.KEYCODE_MENU) {myActivity.this.removeDialog (ID); return true;} return false;} So every time the dialog menu is created by the press, it immediately hides it by the audience.
Do my dialog menu with the menu button Have an idea to create?
@ Override public boolean on crat option menu (menu menu) {MenuInflater inflater = GetMenuInflater (); inflater.inflate (R.menu.menu, menu); true return;} @ override public boolean on option itam select (menu item) {layoutinfletter le = layout inflator.fr (fr); switch (ietate.get) ITMID (case) {Case R.ID help: // ... etc, etc} /res/menu/menu.xml:
Menu xmlns: and Android = "http://schemas.android.com/apk/res/an Droid "& gt; & Lt; Android Android: id = "@ + ID / Support" Android: title = "help" /> & Lt; Item android: id = "@ + ID / About" Android: title = "About" /> & Lt; Android Android: id = "@ + ID / Prefaces" Android: Title = "Preferences" /> & Lt; / Menu & gt;
Comments
Post a Comment