1*90c8c64dSAndroid Build Coastguard Worker<?xml version="1.0" encoding="utf-8"?> 2*90c8c64dSAndroid Build Coastguard Worker<!-- 3*90c8c64dSAndroid Build Coastguard Worker Copyright 2013 The Android Open Source Project 4*90c8c64dSAndroid Build Coastguard Worker 5*90c8c64dSAndroid Build Coastguard Worker Licensed under the Apache License, Version 2.0 (the "License"); 6*90c8c64dSAndroid Build Coastguard Worker you may not use this file except in compliance with the License. 7*90c8c64dSAndroid Build Coastguard Worker You may obtain a copy of the License at 8*90c8c64dSAndroid Build Coastguard Worker 9*90c8c64dSAndroid Build Coastguard Worker http://www.apache.org/licenses/LICENSE-2.0 10*90c8c64dSAndroid Build Coastguard Worker 11*90c8c64dSAndroid Build Coastguard Worker Unless required by applicable law or agreed to in writing, software 12*90c8c64dSAndroid Build Coastguard Worker distributed under the License is distributed on an "AS IS" BASIS, 13*90c8c64dSAndroid Build Coastguard Worker WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14*90c8c64dSAndroid Build Coastguard Worker See the License for the specific language governing permissions and 15*90c8c64dSAndroid Build Coastguard Worker limitations under the License. 16*90c8c64dSAndroid Build Coastguard Worker--> 17*90c8c64dSAndroid Build Coastguard Worker 18*90c8c64dSAndroid Build Coastguard Worker<!-- 19*90c8c64dSAndroid Build Coastguard Worker As we're using ActionBarCompat, any action item attributes come from ActionBarCompat's XML 20*90c8c64dSAndroid Build Coastguard Worker namespace instead of the android namespace. Here we've added a new support namespace added to 21*90c8c64dSAndroid Build Coastguard Worker the menu element allowing us to use the 'showAsAction' attribute in a backwards compatible way. 22*90c8c64dSAndroid Build Coastguard Worker Any other action item attributes used should be referenced from this namespace too 23*90c8c64dSAndroid Build Coastguard Worker (actionProviderClass, actionViewClass, actionLayout). 24*90c8c64dSAndroid Build Coastguard Worker--> 25*90c8c64dSAndroid Build Coastguard Worker<menu xmlns:android="http://schemas.android.com/apk/res/android" 26*90c8c64dSAndroid Build Coastguard Worker xmlns:support="http://schemas.android.com/apk/res-auto" > 27*90c8c64dSAndroid Build Coastguard Worker 28*90c8c64dSAndroid Build Coastguard Worker <!-- 29*90c8c64dSAndroid Build Coastguard Worker Here we create an item, setting support:showAsAction to display the item as an action if 30*90c8c64dSAndroid Build Coastguard Worker there's room on the compatible Action Bar. 31*90c8c64dSAndroid Build Coastguard Worker --> 32*90c8c64dSAndroid Build Coastguard Worker <item 33*90c8c64dSAndroid Build Coastguard Worker android:id="@+id/menu_refresh" 34*90c8c64dSAndroid Build Coastguard Worker android:icon="@drawable/ic_action_refresh" 35*90c8c64dSAndroid Build Coastguard Worker android:title="@string/menu_refresh" 36*90c8c64dSAndroid Build Coastguard Worker support:showAsAction="ifRoom"/> 37*90c8c64dSAndroid Build Coastguard Worker 38*90c8c64dSAndroid Build Coastguard Worker <!-- Location item is added in onCreateOptionsMenu() --> 39*90c8c64dSAndroid Build Coastguard Worker 40*90c8c64dSAndroid Build Coastguard Worker <!-- 41*90c8c64dSAndroid Build Coastguard Worker Here we set the settings item to always be in the overflow menu, by setting 42*90c8c64dSAndroid Build Coastguard Worker support:showAsAction to never, so it is never displayed as an action item on the compatible 43*90c8c64dSAndroid Build Coastguard Worker Action Bar. 44*90c8c64dSAndroid Build Coastguard Worker --> 45*90c8c64dSAndroid Build Coastguard Worker <item 46*90c8c64dSAndroid Build Coastguard Worker android:id="@+id/menu_settings" 47*90c8c64dSAndroid Build Coastguard Worker android:icon="@drawable/ic_action_settings" 48*90c8c64dSAndroid Build Coastguard Worker android:title="@string/menu_settings" 49*90c8c64dSAndroid Build Coastguard Worker support:showAsAction="never"/> 50*90c8c64dSAndroid Build Coastguard Worker 51*90c8c64dSAndroid Build Coastguard Worker</menu>