Home | History | Annotate | Download | only in menu
      1 <?xml version="1.0" encoding="utf-8"?>
      2 <!-- Copyright (C) 2008 The Android Open Source Project
      3 
      4      Licensed under the Apache License, Version 2.0 (the "License");
      5      you may not use this file except in compliance with the License.
      6      You may obtain a copy of the License at
      7 
      8           http://www.apache.org/licenses/LICENSE-2.0
      9 
     10      Unless required by applicable law or agreed to in writing, software
     11      distributed under the License is distributed on an "AS IS" BASIS,
     12      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13      See the License for the specific language governing permissions and
     14      limitations under the License.
     15 -->
     16 
     17 <menu xmlns:android="http://schemas.android.com/apk/res/android">
     18 
     19     <!-- Checkable items appear only in submenus or context menus. -->
     20 
     21     <!-- Carefully look at the attribute name checkableBehavior on groups, but
     22          the attribute name checkable on items. The checkableBehavior encompasses
     23          the number of items that will be checkable within that group. -->
     24 
     25     <item android:title="None">
     26         <menu>
     27             <!-- The none checkableBehavior is default, but we explicitly show it here. -->
     28             <group android:id="@+id/noncheckable_group"
     29                     android:checkableBehavior="none">
     30                 <!-- Notice how these items inherit from the group. -->
     31                 <item android:id="@+id/noncheckable_item_1"
     32                         android:title="@string/item_1" />
     33                 <item android:id="@+id/noncheckable_item_2"
     34                         android:title="@string/item_2" />
     35                 <item android:id="@+id/noncheckable_item_3"
     36                         android:title="@string/item_3" />
     37             </group>
     38         </menu>
     39     </item>
     40 
     41     <item android:title="All">
     42         <menu>
     43             <group android:id="@+id/checkable_group"
     44                     android:checkableBehavior="all">
     45                 <!-- Notice how these items inherit from the group. -->
     46                 <item android:id="@+id/checkable_item_1"
     47                         android:title="@string/item_1" />
     48                 <item android:id="@+id/checkable_item_2"
     49                         android:title="@string/item_2"
     50                         android:checked="true" />
     51                 <item android:id="@+id/checkable_item_3"
     52                         android:title="@string/item_3"
     53                         android:checked="true" />
     54             </group>
     55         </menu>
     56     </item>
     57 
     58     <item android:title="Single">
     59         <menu>
     60             <group android:id="@+id/exclusive_checkable_group"
     61                     android:checkableBehavior="single">
     62                 <!-- Notice how these items inherit from the group. -->
     63                 <item android:id="@+id/exclusive_checkable_item_1"
     64                         android:title="@string/item_1" />
     65                 <item android:id="@+id/exclusive_checkable_item_2"
     66                         android:title="@string/item_2" />
     67                 <item android:id="@+id/exclusive_checkable_item_3"
     68                         android:title="@string/item_3"
     69                         android:checked="true" />
     70             </group>
     71         </menu>
     72     </item>
     73 
     74     <item android:title="All without group">
     75         <menu>
     76             <!-- Notice how these items have each set. -->
     77             <item android:id="@+id/nongroup_checkable_item_1"
     78                     android:title="@string/item_1"
     79                     android:checkable="true" />
     80             <item android:id="@+id/nongroup_checkable_item_2"
     81                     android:title="@string/item_2"
     82                     android:checkable="true"
     83                     android:checked="true" />
     84             <item android:id="@+id/nongroup_checkable_item_3"
     85                     android:title="@string/item_3"
     86                     android:checkable="true"
     87                     android:checked="true" />
     88         </menu>
     89     </item>
     90 
     91 </menu>
     92