Defining the menu XML file
Actions can be defined in a menu XML file that resides in the Resources/menu
folder, or it can be created programmatically using API calls. We will define the New and Refresh actions in an XML file named POIListViewMenu.xml
.
To create POIListViewMenu.xml
, perform the following steps:
Select the
Resources
folder inPOIApp
, right-click on it, and navigate to Add | New Folder.Name the folder menu.
Select the menu folder, right-click on it, and navigate to Add | New File.
Navigate to XML | Empty XML file, enter
POIListViewMenu.xml
for the name, and click on New.
You now need to fill in the definitions for the two actions we identified. Unfortunately, Xamarin Studio does not contain a template for menu XML files, so you have to hunt the format down from the Android documentation or online examples. The following code contains definitions for actionNew
and actionRefresh
:
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id...