You’ll now use the techniques you learned in Section 7.3.4 to create two menu resource files in the app’s res/menu folder:
• fragment_contact_list_menu.xml
defines the menu item for adding a contact.
• fragment_details_menu.xml
defines the menu items for editing an existing contact and deleting a contact.
When both the ContactListFragment
and the DetailsFragment
are displayed on a tablet at the same time, all of the menu items are displayed.
Figures 8.12–8.13 show the settings for the menu items in the two menu resource files. Each menu item’s Order in category values determines the order in which the menu items appear on the action bar. For each menu item’s Icon value, we specified a standard Android icon. You can see the complete set of standard icons in the Android SDK’s platforms
folder under each platform version’s data/res/drawable-hdpi
folder. To refer to these icons in your menus or layouts, prefix them with @android:drawable/
icon_name.