Application menus are another important part of an application's UI. Menus offers a reliable interface that reveals application functions and settings. The most common application menu is revealed by pressing the MENU key on the device. However, you can also add Context Menus, which may be revealed when the user presses and holds down on an item.
Menus are also structured using a View hierarchy, but you don't define this structure yourself. Instead, you define the
or onCreateOptionsMenu()
callback methods for your Activity and declare the items that you want to include in your menu. At the appropriate time, Android will automatically create the necessary View hierarchy for the menu and draw each of your menu items in it.onCreateContextMenu()
Menus also handle their own events, so there's no need to register event listeners on the items in your menu. When an item in your menu is selected, the
oronOptionsItemSelected()
method will be called by the framework.onContextItemSelected()
And just like your application layout, you have the option to declare the items for you menu in an XML file.
Read Creating Menus to learn more.
0 件のコメント:
コメントを投稿