Android Question Appcompat Menu vs Menu Key

tchart

Well-Known Member
Licensed User
I'm using Appcompat (ie #Extends: android.support.v7.app.AppCompatActivity).

I've noticed that the menu appears in the bar at the top which the user can click to show/hide.

However I also notice that if I press the physical menu key (on my Note 3) I get a menu at the bottom.

Is there any way to disable the bottom menu or even have the physical menu key show/hide the appcompat menu at the top?

Examples below.

2015-06-02 08.33.01.png 2015-06-02 08.32.53.png
 

tchart

Well-Known Member
Licensed User
Thanks TDS, Ive got that part but I would like to show/hide the top right menu when the user presses the menu physical key. I guess I can just interecept the menu pkey and force the user to push the toolbar menu but it would be nicer to show the menu.

Something like this Java code but I dont know how to get the toolbar menu object;

B4X:
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_MENU) {
        if (mToolbar.isOverflowMenuShowing()) {
            mToolbar.hideOverflowMenu();
        } else {
            mToolbar.showOverflowMenu();
        }
        return true;
    }
    return super.onKeyUp(keyCode, event);
}
 
Top