当前位置: 首页>>代码示例>>C#>>正文


C# Views.MenuInflater类代码示例

本文整理汇总了C#中Android.Views.MenuInflater的典型用法代码示例。如果您正苦于以下问题:C# MenuInflater类的具体用法?C# MenuInflater怎么用?C# MenuInflater使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MenuInflater类属于Android.Views命名空间,在下文中一共展示了MenuInflater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            Activity.MenuInflater.Inflate (Resource.Menu.schedule_menu, menu);

            //Handle share action provider
            var shareMenuItem = menu.FindItem (Resource.Id.action_schedule_share);
            var shareActionProvider =
                (ShareActionProvider)shareMenuItem.ActionProvider;
            shareActionProvider.SetShareIntent (CreateIntent ());

            //Handle search action provider
            var searchOption = menu.FindItem(Resource.Id.action_schedule_search);

            //Handle expand/colapse of action bar
            MenuItemCompat.SetOnActionExpandListener(searchOption, new SearchViewExpandListener(_adapter));

            var searchItem = MenuItemCompat.GetActionView(searchOption);
            _searchView = searchItem.JavaCast<SearchView>();
            _searchView.QueryTextChange += (s, e) => _adapter.Filter.InvokeFilter(e.NewText);

            _searchView.QueryTextSubmit += (s, e) =>
            {
                Toast.MakeText(Activity, "Searched for: " + e.Query, ToastLength.Short).Show();
                e.Handled = true;
            };
        }
开发者ID:jheerman,项目名称:LGSAMobile,代码行数:26,代码来源:ScheduleFragment.cs

示例2: OnCreateOptionsMenu

 public override bool OnCreateOptionsMenu(IMenu menu)
 {
     base.OnCreateOptionsMenu(menu);
     MenuInflater inflater = new MenuInflater(this);
     inflater.Inflate(Resource.Layout.XmlMenu, menu);
     return true;
 }
开发者ID:caodaiming,项目名称:Gamodo.Droid.Examples,代码行数:7,代码来源:XmlMenuActivity.cs

示例3: OnCreateOptionsMenu

        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater menuInflater = new Android.Views.MenuInflater(this);
            menuInflater.Inflate(Resource.Layout.MenuNewsDetails, menu);

            return true;
        }
开发者ID:00091701,项目名称:ADFC-NewsApp-Mono,代码行数:7,代码来源:NewsDetails.cs

示例4: OnCreateOptionsMenu

		public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
		{
			var conferencesScheduleViewModel = this.DataContext as ConferencesScheduleViewModel;

			inflater.Inflate(Resource.Menu.ConferencesListActionItems, menu);

			var searchView = (SearchView)menu.FindItem(Resource.Id.menu_search).ActionView;

			var textChangedLastTime = DateTime.Now;
			searchView.QueryTextChange += async (object sender, SearchView.QueryTextChangeEventArgs e) => 
			{
				var changedSpan = DateTime.Now.Subtract(textChangedLastTime);
				if (changedSpan.TotalMilliseconds > 200)
				{
					await conferencesScheduleViewModel.SearchAsync(e.NewText);
				}
				textChangedLastTime = DateTime.Now;
			};

			searchView.Close += async (sender, e) => 
			{
				await conferencesScheduleViewModel.LoadConferencesAsync(LoadRequest.Load);
				searchView.ClearFocus();
				searchView.OnActionViewCollapsed();
			};

			searchView.QueryTextSubmit += async (sender, e) => {
				await conferencesScheduleViewModel.SearchAsync(e.Query);
				searchView.ClearFocus();
				searchView.OnActionViewCollapsed(); 
			};
		}
开发者ID:prca,项目名称:tekconf.mobile,代码行数:32,代码来源:ConferencesScheduleFragment.cs

示例5: OnCreateOptionsMenu

		public override void OnCreateOptionsMenu (IMenu menu, MenuInflater inflater)
		{
			base.OnCreateOptionsMenu (menu, inflater);

			menu.RemoveItem (Resource.Id.action_search);
			menu.RemoveItem (Resource.Id.action_radar);
			menu.RemoveItem (Resource.Id.action_settings);
		}
开发者ID:colbylwilliams,项目名称:XWeather,代码行数:8,代码来源:SettingsFragment.cs

示例6: OnCreateOptionsMenu

        /// <inheritdoc/>
        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            ZTnTrace.Trace(MethodBase.GetCurrentMethod());

            Activity.MenuInflater.Inflate(Resource.Menu.HomeActivity, menu);

            base.OnCreateOptionsMenu(menu, inflater);
        }
开发者ID:djtms,项目名称:D3-Android-by-ZTn,代码行数:9,代码来源:CareersListFragment.cs

示例7: OnCreateOptionsMenu

		public override void OnCreateOptionsMenu (IMenu menu, MenuInflater menuInflater) {
			menuInflater.Inflate (Resource.Layout.order_menu, menu);
			favourite = menu.FindItem (Resource.Id.fav);

			favourite.SetVisible (false);

			base.OnCreateOptionsMenu (menu, menuInflater);
		}
开发者ID:damian-grasso,项目名称:taptap,代码行数:8,代码来源:CoffeeFragment.cs

示例8: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            // Put overlay items first
            MapView.OverlayManager.OnCreateOptionsMenu(menu, MenuLastId, MapView);

            menu.Add(0, MenuZoominId, Menu.None, "ZoomIn");
            menu.Add(0, MenuZoomoutId, Menu.None, "ZoomOut");

            base.OnCreateOptionsMenu(menu, inflater);
        }
开发者ID:JohnPilczak,项目名称:OsmdroidXamarin,代码行数:10,代码来源:SampleWithMinimapItemizedOverlayWithFocus.cs

示例9: OnCreateOptionsMenu

 public void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
 {
     // If the drawer is open, show the global app actions in the action bar. See also
     // showGlobalContextActionBar, which controls the top-left area of the action bar.
     if (mDrawerLayout != null && isDrawerOpen()) {
         inflater.Inflate(Resource.Menu.global, menu);
         showGlobalContextActionBar();
     }
     base.OnCreateOptionsMenu(menu, inflater);
 }
开发者ID:neelanu,项目名称:xamarin_samples,代码行数:10,代码来源:NavigationDrawerFragment.cs

示例10: OnCreateOptionsMenu

			public override void OnCreateOptionsMenu (IMenu menu, MenuInflater inflater)
			{
				base.OnCreateOptionsMenu (menu, inflater);
				
				IMenuItem item;
				item = menu.Add("Menu 1a");
				MenuCompat.SetShowAsAction(item, MenuItemCompat.ShowAsActionIfRoom);
				item = menu.Add("Menu 1b");
				MenuCompat.SetShowAsAction(item, MenuItemCompat.ShowAsActionIfRoom);
			}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:10,代码来源:FragmentMenuSupport.cs

示例11: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            base.OnCreateOptionsMenu(menu, inflater);

            inflater.Inflate(Resource.Menu.menuitem, menu);

            refreshButton = new MenuItemWrapper(menu.FindItem(Resource.Id.refresh));

            var bindingSet = this.CreateBindingSet<LastAddedTournamentsView, LastAddedTournamentsViewModel>();
            bindingSet.Bind(refreshButton).For(n => n.Visible).To(vm => vm.DataLoader.HasError);
            bindingSet.Apply();            
        }
开发者ID:fatelord,项目名称:chgk,代码行数:12,代码来源:LastAddedTournamentsView.cs

示例12: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate (Resource.Menu.ActionMenu, menu);

            // Set up the search
            var search = menu.FindItem (Resource.Id.actionSearch);
            var searchView = MenuItemCompat.GetActionView (search);
            mSearch = searchView.JavaCast<SupportSearch> ();

            // Check for query and filter ListView
            mSearch.QueryTextChange += (sender, e) => mAdapter.Filter.InvokeFilter(e.NewText);
            mSearch.QueryTextSubmit += (sender, e) => {};
        }
开发者ID:kuramu1108,项目名称:ConnectUTS,代码行数:13,代码来源:FriendsFragment.cs

示例13: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate(Resource.Menu.menu, menu);
            var cartItem = menu.FindItem(Resource.Id.cart_menu_item);
            cartItem.SetIcon((basketBadge = new BadgeDrawable(cartItem.Icon)));

            var order = WebService.Shared.CurrentOrder;
            if (badgeCount != order.Products.Count)
                basketBadge.SetCountAnimated(order.Products.Count);
            else
                basketBadge.Count = order.Products.Count;
            badgeCount = order.Products.Count;
            order.ProductsChanged += (sender, e) => basketBadge.SetCountAnimated(order.Products.Count);
            base.OnCreateOptionsMenu(menu, inflater);
        }
开发者ID:pmourfield,项目名称:xamarin-store-app,代码行数:15,代码来源:ProductListFragment.cs

示例14: OnCreateOptionsMenu

		public override void OnCreateOptionsMenu (IMenu menu, MenuInflater inflater)
		{
			base.OnCreateOptionsMenu (menu, inflater);
			inflater.Inflate (Resource.Menu.question, menu);

			_timeText = menu.FindItem (Resource.Id.time).ActionView as TextView;
			_startButton = new MenuItemWrapper (menu.FindItem (Resource.Id.start_timer));
			_stopButton = new MenuItemWrapper (menu.FindItem (Resource.Id.stop_timer));

			var bindingSet = this.CreateBindingSet<QuestionView, QuestionViewModel> ();
			bindingSet.Bind (_timeText).For (n => n.Text).To (vm => vm.Time).WithConversion ("Timer");
			bindingSet.Bind (_startButton).For (n => n.Visible).To (vm => vm.IsTimerStopped);
			bindingSet.Bind (_stopButton).For (n => n.Visible).To (vm => vm.IsTimerStarted);
			bindingSet.Apply ();
		}
开发者ID:fatelord,项目名称:chgk,代码行数:15,代码来源:QuestionView.cs

示例15: OnCreateOptionsMenu

        public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
        {
            inflater.Inflate (Resource.Menu.NewsList, menu);

            var searchManager = (global::Android.App.SearchManager)Activity.GetSystemService(Context.SearchService);
            var searchItem = menu.FindItem (Resource.Id.Search);
            var searchView = searchItem.ActionView.JavaCast<SearchView>();
            searchView.SetSearchableInfo(searchManager.GetSearchableInfo(Activity.ComponentName));
            searchView.QueryTextChange += (object sender, SearchView.QueryTextChangeEventArgs e) =>
            {
                FindArticles(e.NewText);
            };

            base.OnCreateOptionsMenu(menu, inflater);
        }
开发者ID:T-Rex,项目名称:demo-android-article-list,代码行数:15,代码来源:NewsListFragment.cs


注:本文中的Android.Views.MenuInflater类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。