Android menu

Menu :

Android provides an easy and flexible user interface component known as menu, which is used to handle a set of actions. Menu is a set of options, the user can select from to perform an action . Android menu provide a familiar and consistent user experience all over the application. Based upon the menu item clicked, a certain action can be performed by the application such as add, search, delete, edit, or refresh etc. Android menu comes from Android 3.0 (API level 11).

Types of Menu :

Android offers three fundamental types of menus :

  1. Option Menu
  2. Context Menu
  3. Popup Menu

1. Option Menu :

Android option menu is the primary collection of menu items for an activity. It is the place where we implement the actions that have a global impact on the app, such as Search, Settings and Delete. Option menu appears in the app bar and provides the primary options.

option menu
Option Menu

2. Context Menu :

Context menu provides a set of menu options when user perform long click on an Element. Most often context menu is used for items in a RecyclerView, GridView, ListView or other view collections in which the user can perform direct actions on each item.

Context menu
Context Menu

Android provides two different way of context menu :-

Floating Menu :

A floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or a view element on the screen. It provides a floating list of menu items when the user performs a long tap on an item/element.

Contextual action bar :

A contextual action bar appears at the top of the screen in place of the app bar or underneath the app bar, with action items that affect the selected view element(s). When a user enables this mode by selecting an item, a contextual action bar appears at the top of the screen to present actions the user can perform on the currently selected item(s).

3. Popup Menu :

Android provides an easy and flexible menu style i.e. Popup menu. A popup menu displays a list of items in a vertical list that’s anchored to the view that invoked the menu. Android popup menu appears below the anchor view if there is room, or above the view otherwise.Popup menu provides an overflow-style menu for actions that relate to specific content (such as Gmail’s email headers). Popup Menu is available from API level 11 .

popup menu
Popup menu
%d bloggers like this: