Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2093275
  • 博文数量: 413
  • 博客积分: 10926
  • 博客等级: 上将
  • 技术积分: 3862
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-09 18:14
文章分类

全部博文(413)

文章存档

2015年(5)

2014年(1)

2013年(5)

2012年(6)

2011年(138)

2010年(85)

2009年(42)

2008年(46)

2007年(26)

2006年(59)

分类: LINUX

2010-09-09 16:52:00

  1. Documents
    • Creating Menus
      http://developer.android.com/guide/topics/ui/menus.html
    • Menu Design Guidelines
      http://developer.android.com/guide/practices/ui_guidelines/menu_design.html
    • Menu Resource (Create menu in resource file)
      http://developer.android.com/guide/topics/resources/menu-resource.html
    • Menu Design Guidelines
      http://developer.android.com/guide/practices/ui_guidelines/menu_design.html
    • xxx
  2. Overview
    (If you are developing app for Android 3.0 or higher, you can use ActionBar instead)
    1. Option menu
      An Options menu holds commands that are global to the activity, it is typically invoked by a user pressing a hard button, often labeled MENU.
    2. Context menu
      A floating list of menu items that appears when the user touches and holds (long press) a view that's registered to provide a context menu. You can create a context menu for any View, though context menus are most often used for items in a ListView.
    3. Sub menu
      A floating list of menu items that appears when the user touches a menu item that contains a nested menu.
    4. Menu group
      It allows you to categorize menu items so they share properties such as active state and visibility, by invoking setGroupVisible(), setGroupEnabled(), setGroupCheckable()
    5. Add checkbox on menu items
    6. Add radio button on menu items
    7. Short key
    8. Allowing your Activity to be added to menus of other applications
    9. Create menu in .xml and inflate in .Java
    10. Create menu in .Java
  3. Classes
    1. Menu
    2. SubMenu
    3. MenuItem
    4. MenuInflater
      To instantiate menu XML files into Menu objects. The MeuInflater object can be get by invoking Activity.getMenuInflater().
    5. xxx
  4. Option Menu
    Override the following functions in the subclass of Activity
    • boolean onCreateOptionsMenu(Menu menu)
      When the Android system creates the Options Menu for the FIRST time, it calls your activity's onCreateOptionsMenu() method. (But on Android 3.0 and greater, the system creates it as soon as the activity is created, in order to populate the Action Bar.) The system keeps and re-uses the Menu you define in this method until your activity is destroyed.
    • boolean onOptionsItemSelected(MenuItem item)
      When the user selects a menu item from the Options Menu (including action items in the Action Bar), the system calls your activity's onOptionsItemSelected() method.
      Additionally, Android 3.0 adds the ability for you to define the on-click behavior for a menu item in the menu resource XML, using the android:onClick attribute

      If your application contains multiple activities and some of them provide the same Options Menu, consider creating an activity that implements nothing except the onCreateOptionsMenu() and onOptionsItemSelected() methods, then extend this class for each activity that should share the same Options Menu.
    • boolean onCreateOptionsMenu (Menu menu)
      If you want to change the Options Menu any time after it's first created, you must override the onPrepareOptionsMenu() method. This is useful if you'd like to remove, add, disable, or enable menu items depending on the current state of your application.
    • xxx
  5. Context Menu
    • Register context menu
      public void registerForContextMenu (View view)
      Pass it the View you want to give a context menu. When this View then receives a long-press, it displays a context menu.
    • Create context menu
      public void  onCreateContextMenu (ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
    • Reponde to context menu item
      public boolean onContextItemSelected  (MenuItem item)
    • Unregister context menu
      public void  unregisterForContextMenu  (View view)
    • xxx
  6. Design Guide
    Ref: http://developer.android.com/guide/practices/ui_guidelines/menu_design.html#Guidelines
    • Separate selection-specific commands from global commands
      Put any commands that are global to the current activity in the Options menu or place them fixed in an activity screen; put commands that apply to the current selection in the Context menu.
    • Place the most frequently used operations first
    • Don't put commands only in a Context menu
    • The first command in a Context menu should be the selection's most intuitive command
    • Selecting an item in the content should perform the most intuitive operation
    • A Context menu should identify the selected item
      When creating a Context menu, be sure to include a title and the name of the selected item so that it's clear to the user what the context is
    • Put only the most important commands fixed on the screen
      By putting commands in menus, you free up the screen to hold more content. Here are a number of important reasons to place commands fixed on the activity screen:
      • A "Buy" button in a store application.
      • Next/Previous buttons or Zoom In/Out buttons in an image viewing application.
      • Save/Discard buttons in an image crop activity.
      • ...
    • Use short names in the Options icon menu
      If a text label in the Options icon menu is too long, the system truncates it in the middle.
    • A dialog should not have an Options menu
      When a dialog is displayed, pressing the MENU button should do nothing. This also holds true for activities that look like dialogs.
    • If an activity has no Options menu, do not display a message when MENU hard button is pressed
    • Dim or hide menu item if it can not be performed
      • In Context Menu - Disable menu item
      • In Option Menu - Hide  menu item
    • xxx
  7. xxx
阅读(769) | 评论(0) | 转发(0) |
0

上一篇:[Android] ListView

下一篇:[Android] Eula

给主人留下些什么吧!~~