Free Shipping

Secure Payment

easy returns

24/7 support

  • Home
  • Blog
  • Introduction to Menus in Android

Introduction to Menus in Android

 July 14  | 0 Comments

This Blog gives you the information about the different Menu types and how to create menus in different Android versions. Let us now talk about Menus.

Menus are user interface component used in many types of applications. To provide a familiar user experience, you should use the Menu APIs for user actions.

Starting from Android 3.0 (API 11), Android based devices no longer have a dedicated Menu button. Instead Android apps need to provide an app bar to present common user actions.

In Android applications, Menu is an important user interface entity which provides action options for Android applications.

Mainly 3 types of Menus are used in Android:

1. Options Menu

2. Context Menu

3. Popup Menu

Options Menu

The Options Menu is the collections of menu items required for an activity. This is where you place actions having global impact like “Search”, “Compose Mail” and “Settings”.

Note: i) If you are developing for Android 2.3 or lower versions then users can reveal the options menu by pressing the Menu Button.

ii) For Android 3.0 and higher versions, the items are presented by the app bar as a combination of on-screen action items and other options.

Context Menu

A Context menu is a floating menu that appears when the user performs a long-click on an Element. It provides actions that affect the selected content or context frame.

Context menu uses contextual action mode (It is a system implementation of action mode class) to enable actions on selected content. This mode displays action items that affect the selected content in a bar.

Popup Menu

A Popup Menu displays a list of items in a vertical list that invoked the menu. It’s good for providing an overflow of actions that relate to specific options. Actions in a popup menu should not affect the corresponding content.

The Popup menu is used for extended actions that relate to regions of content in activity.

Define the Menu in XML File

For defining the Menus, Android provides the standard XML format to define menu items. Instead of creating the menu in individual’s activity code, we can define menu and its items in an XML menu resource.

For defining menu in XML file, <menu> is used, which is a container of menu items. It is a root element of any root node. For creating a MenuItem in menu, <item> is used, which represents the single item in menu.

Here is one example for MenuItem:

Example – Using Popup Menu in Android
Android Popup Menu displays the menu generally below the text/button if space is available.
Otherwise it is displayed above the text/button.
The android.widget.PopupMenu is the class used for Popup Menu in Android.
We are taking one Button.



Output Of Popup Menu

  1. Click on “Show Popup”

Output Of Popup Menu

  1. Click on Popup Item and It will give you Toast as below:

Output Of Popup Menu

Thus, we have successfully created Popup Menu with this Example.


Menus are slightly different from other UI components. Menus are a hierarchy of the options. App users love powerful options and features if the same are not well organized within the app’s interface then they might as well not even exist.

Depending on what you’ve built, these options and features could affect the way that the app behaves. They could offer extensive customization options or could even tie into APIs, other apps, hardware capabilities, or other external technologies. But, they’ll have to be intuitive and organized to be at their best.

I hope you found this blog helpful about the different Menu types.