Understanding Options and Context Menus

Android provides a simple mechanism for you to add menus to your applications. You find the following types of menus:

check.png Options menu or action bar menu: This is, most likely, the most common type of menu that you’ll work with. It’s the primary menu for an activity or fragment.

On Android 3.x and later, the Options menu is in the action bar at the top of the screen (read more about the action bar in Chapter 1). On Android 2.x and earlier, the Options menu is presented to the user with the press of the Menu key on the device. Figure 10-1 shows the same menus on two different devices.

Within the options menu are two groups:

Icon: These menu options are available at the bottom of the screen. The device supports up to six menu items, and they’re the only menu items that support the use of icons. They don’t support check boxes or radio buttons.

Expanded: The expanded menu is a list of menu items that goes beyond the six menu items on the Icon menu. This menu is presented by the More menu icon that is automatically placed onscreen when the app developer has more items than will fit on the Icon menu.

Figure 10-1: The options menu on an Android 2.x device (left), and on an Android 4.x device (right).

9781118417454-fg1001.eps

Context menu: A floating list of menu ...

Get Android Application Development For Dummies, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.