Android provides three menu types: Options menu, context menu, and sub menu.
The options menu is displayed by pressing the Home key. The context menu needs to be displayed after pressing the top 2 S button on The View. Both menus can be added to sub-menus. Sub-menus cannot be nested.
The options menu can display up to six menu options at the bottom of the screen. It becomes an icon menu, and the icon menu cannot have the checkable option. The more Icon menu will be used to call out the excess 6 to become the expanded menu. Options menu is generated by oncreateoptionsmenu of the activity. This function is called only when the menu is generated for the first time. Any idea of changing the Options menu can only be implemented in onprepareoptionsmenu. This function will be called before the menu is displayed. Onoptionsitemselected processes the selected menu items.
Context menu is bound to a specific view. In activity, registerforcontextmenu is used to register context menu for a view. Before the context menu is displayed, oncreatecontextmenu is called to generate the menu. Oncontextitemselected: The selected menu item.
Android also provides the function of grouping menu items. You can divide menu items with similar functions into the same group. In this way, you can set menu properties by calling setgroupcheckable, setgroupenabled, and setgroupvisible, you do not need to set it separately.