Beispiel #1
0
            public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
            {
                base.OnCreateOptionsMenu(menu, inflater);

                IMenuItem item;

                item = menu.Add("Menu 2");
                MenuCompat.SetShowAsAction(item, MenuItemCompat.ShowAsActionIfRoom);
            }
            public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
            {
                // Place an action bar item for searching.
                var item = menu.Add("Search");

                item.SetIcon(Android.Resource.Drawable.IcMenuSearch);
                MenuCompat.SetShowAsAction(item, MenuItemCompat.ShowAsActionAlways);
                var searchView = SearchViewCompat.NewSearchView(Activity);

                if (searchView != null)
                {
                    SearchViewCompat.SetOnQueryTextListener(searchView, new MyOnQueryTextListenerCompat(this));
                    MenuItemCompat.SetActionView(item, searchView);
                }
            }