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


C# MenuInflater.Inflate方法代码示例

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


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

示例1: 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

示例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

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

            base.OnCreateOptionsMenu(menu, inflater);

            inflater.Inflate(Resource.Menu.ViewHeroActivity, menu);
        }
开发者ID:djtms,项目名称:D3-Android-by-ZTn,代码行数:9,代码来源:FetchHeroFragment.cs

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: OnCreateOptionsMenu

 public override void OnCreateOptionsMenu(IMenu menu, MenuInflater menuInflater)
 {
     menuInflater.Inflate(Resource.Menu.menu_sessions, menu);
 }
开发者ID:nepula-h-okuyama,项目名称:DroidKaigi2016Xamarin,代码行数:4,代码来源:SessionsFragment.cs

示例15: OnCreateOptionsMenu

 public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
 {
     inflater.Inflate(Resource.Menu.calendar_display_modes, menu);
 }
开发者ID:camlt,项目名称:Android-samples,代码行数:4,代码来源:DisplayModeFragment.cs


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