forked from hussien89aa/XamarinAndroidTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmen_Snapsoot.txt
More file actions
38 lines (29 loc) · 859 Bytes
/
men_Snapsoot.txt
File metadata and controls
38 lines (29 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// define menu in xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/new_game"
android:icon="@drawable/ic_new_game"
android:title="@string/new_game"
android:showAsAction="ifRoom"/>
</menu>
//show actions options
showAsAction="always"
showAsAction="ifRoom"
showAsAction=“never”
// create menu
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater.Inflate(Resource.Menu.main_menu, menu);
return base.OnCreateOptionsMenu(menu);
}
//select from menu
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.new_game:
//do something
return true;
}
return base.OnOptionsItemSelected(item);
}