• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Views.MenuInflater类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnCreateOptionsMenu

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

            miAddAtt = menu.Add (1, 1, 1, @"Начать посещение");
            miAddAtt.SetIcon (Resource.Drawable.ic_add_circle_outline_white_48dp);
            //			miAddAtt.SetShowAsAction()
            miAddAtt.SetEnabled (true);

            //			miAddAtt.Id

            miAddPhoto = menu.Add(1, 2, 2, @"Добавить фото");
            miAddPhoto.SetIcon (Resource.Drawable.ic_camera_alt_white_48dp);
            miAddPhoto.SetEnabled (false);

            base.OnCreateOptionsMenu (menu, inflater);
        }
开发者ID:pafik13,项目名称:pharm-merch-tablet,代码行数:17,代码来源:MainFragment+-+копия.cs


示例17: OnCreateOptionsMenu

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

            var menuItem = menu.FindItem(Resource.Id.action_share);

            var shareActionProvider = (ShareActionProvider)menuItem.ActionProvider;

            if (shareActionProvider != null)
            {
                shareActionProvider.SetShareIntent(Intents.CreateShareForecastIntent(_forecastString + " #SpringTimeApp"));
            }
            else
            {
                Log.Debug("SpringTime", "Share Action Provider is null?");
            }
        }
开发者ID:chadsmith12,项目名称:Spring-Time,代码行数:17,代码来源:DetailFragment.cs


示例18: OnCreateOptionsMenu

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

            inflater.Inflate(HasSearchView ? Resource.Menu.options_menu : Resource.Menu.options_menu_nosearch, menu);

            IMenuItem searchItem = menu.FindItem(Resource.Id.action_search);
            if(null == searchItem) {
                return;
            }

            View actionView = Android.Support.V4.View.MenuItemCompat.GetActionView(searchItem);
            FilterView = actionView.JavaCast<Android.Support.V7.Widget.SearchView>();

            // TODO: let the subclasses set this up
            FilterView.QueryHint = Resources.GetString(Resource.String.search_hint);
        }
开发者ID:Luminoth,项目名称:BackpackPlanner,代码行数:17,代码来源:BaseFragment.cs


示例19: OnCreateOptionsMenu

		/// <summary>
		/// Raised, when option menu for this fragment should be created.
		/// </summary>
		/// <param name="menu">Menu.</param>
		/// <param name="inflater">Inflater.</param>
		public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
		{
			inflater.Inflate (Resource.Menu.ScreenMainMenu, menu);

			menuSave = menu.FindItem (Resource.Id.menu_screen_main_save);
			menuQuit = menu.FindItem (Resource.Id.menu_screen_main_quit);

			base.OnCreateOptionsMenu(menu, inflater);

//			menuSave = menu.Add(Resource.String.menu_screen_main_save);
//			menuSave.SetShowAsAction(ShowAsAction.Always);
//			menuSave.SetIcon(Resource.Drawable.menu_save);
//			menuQuit = menu.Add(Resource.String.menu_screen_main_quit);
//			menuQuit.SetShowAsAction(ShowAsAction.Always);
//			menuQuit.SetIcon(Resource.Drawable.lock_power_off);
//			//			ISubMenu sub = menu.AddSubMenu ("Theme");
//			//			sub.Add (0, Resource.Style.Theme_Sherlock, 0, "Default");
//			//			sub.Add (0, Resource.Style.Theme_Sherlock_Light, 0, "Light");
//			//			sub.Add (0, Resource.Style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
//			//			sub.Item.Show.SetShowAsAction (MenuItem.ShowAsActionAlways | MenuItem.ShowAsActionWithText);
		}
开发者ID:jonny65,项目名称:WF.Player.Android,代码行数:26,代码来源:ScreenMainAndroid.cs


示例20: OnCreateOptionsMenu

 public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
 {
     inflater.Inflate(Resource.Menu.refresh, menu);
 }
开发者ID:RyanKonz,项目名称:Xam.NavDrawer,代码行数:4,代码来源:BrowseFragment.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Views.MotionEvent类代码示例发布时间:2022-05-24
下一篇:
C# Views.LayoutInflater类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap