Can I detect click/tap on the menu button of action bar, i.e. used to show overflow menu items?
By default it opens up the list with one item \"Settings\". Here is t
If you have setup Toolbar and inflated menu correctly, just use these two function in MainActivity
@Override
public boolean onMenuOpened(int featureId, Menu menu) {
//Perform some action on menu open
return super.onMenuOpened(featureId, menu);
}
@Override
public void onPanelClosed(int featureId, Menu menu) {
//Perform some action on menu closed
}
Setup toolbar in onCreate function of MainActivity
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
And inflate your menu which is defined in xml file
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.my_menu, menu);
return true;
}
my_menu.xml