示例#1
0
 public override bool OnPrepareOptionsMenu(Android.Views.IMenu menu)
 {
     if (mSortMode != -1)
     {
         var icon = menu.FindItem(mSortMode).Icon;
         menu.FindItem(Resource.Id.action_sort).SetIcon(icon);
     }
     return(base.OnPrepareOptionsMenu(menu));
 }
示例#2
0
        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu_events, menu);
            var item = menu.FindItem(Resource.Id.menu_filter_events);

            item.SetTitle(Settings.ShowAllEvents ? Resource.String.limit_events : Resource.String.show_all_events);
            return(base.OnCreateOptionsMenu(menu));
        }
示例#3
0
        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            // Be sure to call the super class.
            base.OnCreateOptionsMenu(menu);

            // Inflate the menu and configure the media router action provider.
            MenuInflater.Inflate(Resource.Menu.sample_media_router_menu, menu);

            var mediaRouteMenuItem       = menu.FindItem(Resource.Id.media_route_menu_item);
            var mediaRouteActionProvider =
                MenuItemCompat.GetActionProvider(mediaRouteMenuItem).JavaCast <Android.Support.V7.App.MediaRouteActionProvider> ();

            mediaRouteActionProvider.RouteSelector = mSelector;

            // Return true to show the menu.
            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));
        }
示例#5
0
        public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
        {
            var inflater = MenuInflater;

            inflater.Inflate(Resource.Menu.actions, menu);
            var arg1 = menu.FindItem(Resource.Id.action_search);

            var test = new Android.Support.V7.Widget.SearchView(this);

            arg1.SetActionView(test);

            var searchView  = MenuItemCompat.GetActionView(arg1);
            var searchView2 = searchView as Android.Support.V7.Widget.SearchView;

            searchView2.QueryTextChange += (sender, e) => {
                e.Handled = OnQueryTextChange(e.NewText);
            };

            searchView2.QueryTextSubmit += (sender, e) => {
                e.Handled = OnQueryTextSubmit(e.Query);
            };

            return(true);
        }