Menus

The top-right area of the app bar is reserved for the app bar’s menu. The menu consists of action items (sometimes referred to as menu items), which can perform an action on the current screen or on the app as a whole. You will add an action item to allow the user to create a new crime.

Your new action item will need a string resource for its label. Open res/values/strings.xml and add a string label describing your new action.

Listing 15.1  Adding a string for menu (res/values/strings.xml)

<resources>
    ...
    <string name="crime_solved_label">Solved</string>
    <string name="new_crime">New Crime</string>
</resources>

The action item also needs an icon. Just like when you added a right arrow icon back in Chapter 2, you will ...

Get Android Programming: The Big Nerd Ranch Guide, 5th Edition 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.