// Menu aanmaken met de drie schermen voor navigatie binnen de applicatie
 public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
 {
     base.OnCreateOptionsMenu(menu);
     int groupId = 0;
     int menuItemId = Android.Views.Menu.First;
     int menuItemOrder = Android.Views.Menu.None;
     // Text to be displayed for this menu item.
     int menuItemText = Resource.String.menuitem1;
     // Create the menu item and keep a reference to it.
     //Het eerste menu item wordt hier toegevoegd
     IMenuItem menuItem1 = menu.Add(groupId, menuItemId, menuItemOrder, menuItemText);
     menuItem1.SetShortcut('1', 'a');
     Int32 MenuGroup = 10;
     //Het tweede menu item wordt hier toegevoegd
     IMenuItem menuItem2 =
         menu.Add(MenuGroup, menuItemId + 1, menuItemOrder + 1,
             new Java.Lang.String("Toevoegen"));
     menuItem2.SetShortcut('2', 'b');
     //Het derde menu item wordt hier toegevoegd
     IMenuItem menuItem3 =
         menu.Add(MenuGroup, menuItemId + 2, menuItemOrder + 2,
             new Java.Lang.String("Overzicht"));
     menuItem3.SetShortcut('3', 'c');
     return true;
 }
        public static bool CreateOptionsMenu(this Context context, IParentMenu parentMenu, Android.Views.IMenu menu)
        {
            if (parentMenu == null)
            {
                return false;
            }

#warning TODO - make this OO - let the _parentMenu render itself...
            foreach (var child in parentMenu.Children)
            {
                var childCast = child as CaptionAndIconMenu;

                if (childCast != null)
                {
                    var item = menu.Add(1, childCast.UniqueId, 0, childCast.Caption);
                    if (!string.IsNullOrEmpty(childCast.Icon))
                    {
#warning TODO - cannot use Resourcein library code! Should we use reflection here? Or some other mechaniasm?
                        var resourceId = context.Resources.GetIdentifier(childCast.Icon, "drawable", context.PackageName);
                        if (resourceId > 0)
                        {
                            item.SetIcon(resourceId);
                        }
                    }
                }
            }
            return true;
        }
		public override bool OnPrepareOptionsMenu (Android.Views.IMenu menu)
		{
			menu.Clear();

			var items = _viewModel.OptionsMenu;

			foreach(var item in items)
			{
				menu
					.Add(0,
					item.Id,
					0,
					new Java.Lang.String(item.Text));

				var menuItem = menu.FindItem(item.Id);

				switch(item.ShowAs)
				{
				case ShowAs.Hidden:
					{
						menuItem.SetShowAsAction(Android.Views.ShowAsAction.Never);
					}
					break;
				case ShowAs.Visible:
					{
						menuItem.SetShowAsAction(Android.Views.ShowAsAction.IfRoom);
					}
					break;
				default: 
					break;
				}
			}

			return base.OnPrepareOptionsMenu(menu);
		}
Beispiel #4
0
        public override void OnCreateOptionsMenu( Android.Views.IMenu menu, Android.Views.MenuInflater inflater )
        {
            // Fragment Menu Support: Call the base method
            base.OnCreateOptionsMenu ( menu, inflater );

            // Fragment Menu Support: Create menu item(s), as required, and add them to ActionBar option menu
            IMenuItem item = menu.Add(0, 3, 0, "Frag Menu Item");
            MenuCompat.SetShowAsAction(item, MenuItemCompat.ShowAsActionIfRoom);
        }
 public override void OnCreateContextMenu(Android.Views.IContextMenu menu, View v,
     Android.Views.IContextMenuContextMenuInfo menuInfo)
 {
     base.OnCreateContextMenu(menu, v, menuInfo);
     Java.Lang.ICharSequence str0 = new Java.Lang.String("Context Menu");
     Java.Lang.ICharSequence str1 = new Java.Lang.String("Item 1");
     Java.Lang.ICharSequence str2 = new Java.Lang.String("Item 2");
     Java.Lang.ICharSequence str3 = new Java.Lang.String("Item 3");
     Java.Lang.ICharSequence strSubMenu = new Java.Lang.String("Submenu");
     Java.Lang.ICharSequence strSubMenuItem = new Java.Lang.String("Submenu Item");
     menu.SetHeaderTitle(str0);
     menu.Add(0, Android.Views.Menu.First,
         Android.Views.Menu.None, str1).SetIcon(Resource.Drawable.Icon);
     menu.Add(0, Android.Views.Menu.First + 1, Android.Views.Menu.None, str2)
         .SetCheckable(true);
     menu.Add(0, Android.Views.Menu.First + 2, Android.Views.Menu.None, str3)
         .SetShortcut('3', '3');
     ISubMenu sub = menu.AddSubMenu(strSubMenu);
     sub.Add(strSubMenuItem);
 }
Beispiel #6
0
        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            base.OnCreateOptionsMenu(menu);
            int groupID = 0;
            int menuItemID = Android.Views.Menu.First;
            int menuItemOrder = Android.Views.Menu.None;

            // Text weergegeven voor dit menu
            int menuItemText = Resource.String.menuItem1;

            // Maak het menu
            // Item 1
            IMenuItem menuItem1 = menu.Add(groupID, menuItemID, menuItemOrder, menuItemText);
            Int32 MenuGroup = 10;
            // Item 2
            IMenuItem menuItem2 = menu.Add(MenuGroup, menuItemID + 1, menuItemOrder + 1, new Java.Lang.String("Formulier"));
            // Item 3
            IMenuItem menuItem3 = menu.Add(MenuGroup, menuItemID + 2, menuItemOrder + 2, new Java.Lang.String("Overzicht"));

            return true;
        }
		public override bool OnCreateOptionsMenu (Android.Views.IMenu menu)
		{
			// Menu items default to never show in the action bar. On most devices this means
			// they will show in the standard options menu panel when the menu button is pressed.
			// On xlarge-screen devices a "More" button will appear in the far right of the
			// Action Bar that will display remaining items in a cascading menu.

			menu.Add(new Java.Lang.String ("Normal item"));

			var actionItem = menu.Add(new Java.Lang.String ("Action Button"));

			// Items that show as actions should favor the "if room" setting, which will
			// prevent too many buttons from crowding the bar. Extra items will show in the
			// overflow area.
			MenuItemCompat.SetShowAsAction(actionItem, MenuItemCompat.ShowAsActionIfRoom);

			// Items that show as actions are strongly encouraged to use an icon.
			// These icons are shown without a text description, and therefore should
			// be sufficiently descriptive on their own.
			actionItem.SetIcon(Android.Resource.Drawable.IcMenuShare);
			return true;
		}
        public void OnTabSelected(ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
        {
            if (fragment == null)
            {
                fragment = new SampleTabFragment();
                var id = (int)Build.VERSION.SdkInt >= 14 ?
                Android.Resource.Id.Content :
                Resource.Id.action_bar_activity_content;

                ft.Add(id, fragment, "tag");
            }
            else
            {
                ft.Attach(fragment);
            }
            
        }
			public override void OnCreateOptionsMenu (Android.Views.IMenu menu, Android.Views.MenuInflater inflater)
			{
				MenuItemCompat.SetShowAsAction(menu.Add(new Java.Lang.String ("Menu 2")), (int)Android.Views.ShowAsAction.IfRoom);
			}
Beispiel #10
0
			public void OnTabSelected (Android.Support.V7.App.ActionBar.Tab tab, Android.Support.V4.App.FragmentTransaction ft)
			{
				ft.Add (Resource.Id.fragment_content, mFragment, mFragment.Text);
			}