Chapter 12

Going à la Carte with Your Menu

In This Chapter

  • Knowing great menus from bad ones
  • Building an options menu
  • Building a context menu

Okay, I don't mean that kind of menu. Sure, I wish I were down at my favorite Mexican restaurant, ordering some excellent chips and salsa, but I'm not. Instead, I'm talking about menus inside an Android application!

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

  • Action bar: The action bar is a new addition to Android 3.0. The action bar contains the most commonly used menu options you would encounter in a tablet application. These menu options, located in the upper-right side of the application screen, appear as icons with text or simply as text references to the action that they perform.
  • Options menu: The options menu is the most common type of menu that you will work with because it is the primary menu for an activity. This menu is presented when a user presses the Menu key on the device. 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 — the only menu items that support the use of icons. They do not support check boxes or radio buttons, however.
    • Expanded: This group is a list of menu items beyond the original six menu items present in the Icon menu. When the user places more than six items on the Icon menu, the More menu icon appears onscreen. When you click this icon, the additional menu items appear.
  • Context menu: This menu is a floating list of menu items presented when a user long-presses a view.
  • Submenu: A submenu is a floating list of menu items the user can open by clicking a menu item on the options menu or on a context menu. A submenu item cannot support nested submenus.

In this chapter, you create an options menu as well as a context menu for your Task Reminder app. Feel free to grab the full application source code from this book's companion website if you happen to get lost.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.247.77