码迷,mamicode.com
首页 > 其他好文 > 详细

5.User Interface/Menu

时间:2014-11-05 19:02:56      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:des   android   style   blog   http   io   color   ar   os   

1. Menu

  Three fundamental types of menus or action presentation on all versions of Android:

  <1>Option menu and action bar

    Android 2.3 or lower, reveal the options menu panel by pressing MEnu button

    Android 3.0 or higher, options menu are presented by the action bar as a combination of on-screen action items and overflow options

  <2>Context menu and contextual action mode

    floating menu that appears when user performs a long_click on an element

  <3>Popup menu

    displays a list of items in a vertical list that‘s anchored to the view that invoked the menu.

 

2. Defining a Menu in XML

  define a menu and all its items in an XML menu resource. then inflate the menu resource(load it as a Menu object) in activity or fragment

  <menu>  a container for menu items.

  <item>    a single item in a menu

       This element may contain a nested <menu> element in order to create a submenu.

  <group> invisible container for <item> elements

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    // File menu
    <item android:id="@+id/file"
          android:title="@string/file" >
        <!-- "file" submenu -->
        <menu>
            <item android:id="@+id/create_new"
                  android:title="@string/create_new" />
            <item android:id="@+id/open"
                  android:title="@string/open" />
        </menu>
    </item>
   
    // Edit Menu
    <item android:id="@+id/edit"
           .......>
</menu>

 

3. Creating an options Menu

  Android 2.3 or lower. the contents of your options menu appear at the bottom of the screen when the user presses the Menu button,

    bubuko.com,布布扣

  Android 3.0 and higher, items from the options menu are available in the action bar.

  By default, the system places all items in the action overflow, which the user can reveal with the action overflow icon on the right side

    of the action bar

  To enable quick access to important actions, you can promote a few items to appear in the action bar by adding

    android:showAsAction="ifRoom" to the corresponding <item> elements

5.User Interface/Menu

标签:des   android   style   blog   http   io   color   ar   os   

原文地址:http://www.cnblogs.com/iMirror/p/4076864.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!