问题
The onOptionsItemSelected(MenuItem item) method can be used to identify a click on each menu item. But i need to have a listener that can identify the click on the menu title (3 vertical dots at the top right of action bar). How could i implement one?
回答1:
You can override onMenuOpened
(javadoc) on your activity.
回答2:
When you choose basic activity, you get that 3 dot menu with it.
You don't have to add any click listener to that button it is created automatically. Try to run the app in emulator to see the results.
You can edit the default items of that menu from (res>menu>menu_main.xml)
来源:https://stackoverflow.com/questions/38191825/android-how-to-add-a-click-listener-to-menu-icon3-dots-at-the-top