An Alternative Menu Item
In this section, you will use what you have learned about menus, compatibility, and alternative resources to add a menu item that lets users show and hide the subtitle of CrimeListActivity’s action bar.
Creating an alternative menu file
A menu item that applies the action bar should not be visible to users without an action bar. So the first step is to create an alternative menu resource. Create a menu-v11 folder in your project’s res directory. Then copy and paste fragment_crime_list.xml into this folder.
In res/menu-v11/fragment_crime_list.xml, add a menu item that will read Show Subtitle and will appear on the action bar if there is room.
Listing 16.14 Adding Show Subtitle menu item (res/menu-v11/fragment_crime_list.xml ...
Get Android Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.