0

I am using toolbar, add option item in OnCreateOptionsMenu() and set showAsAction="always" so, 3-dot overflow icon does not show. is good work, but show overflow(popup) when i touch the hardware menu key.

I use a hardware key, for other function. How to not show overflow menu in the touch the hardware key?

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Andromer
  • 123
  • 2
  • 12

1 Answers1

0

Found. overflow occurred in KeyUp

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if(keyCode == KeyEvent.KEYCODE_MENU){
        work(); //handle
        return true;
    }

    //not menu key
    return super.onKeyUp(keyCode, event);
}

works for me

Andromer
  • 123
  • 2
  • 12