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)