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


C# IMenu.Clear方法代码示例

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


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

示例1: OnPrepareOptionsMenu

        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            menu.Clear ();
            var menuCounter = 0;
            var item = menu.Add (1, MENU_ID_HISTORY_CLEAR, menuCounter++, Resource.String.urllauncher_menu_clear_history);
            item.SetIcon(Android.Resource.Drawable.IcDelete);

            return true;
        }
开发者ID:Wikitude,项目名称:wikitude-xamarin,代码行数:9,代码来源:ARchitectUrlLauncherActivity.cs

示例2: OnMenuOpened

        public override bool OnMenuOpened(int featureId, IMenu menu)
        {
            menu.Clear();
            MenuInflater.Inflate(Resource.Menu.ActionMenu, menu);

            if (run)
                menu.FindItem(Resource.Id.startstop).SetTitle("Stop");
            else
                menu.FindItem(Resource.Id.startstop).SetTitle("Start");
            return base.OnMenuOpened(featureId, menu);
        }
开发者ID:236422,项目名称:Krokomierz,代码行数:11,代码来源:PedometerActivity.cs

示例3: OnPrepareOptionsMenu

        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            if(ActionBar == null)
                return base.OnPrepareOptionsMenu(menu);

            menu.Clear();
            MenuInflater.Inflate(MenuId, menu);

            for (int i = 0; i < menu.Size(); i++)
            {
                var menuItem = menu.GetItem(i);
                menuItem.SetVisible(!ActionBar.MenuItemsToHide.Contains(menuItem.ItemId));
            }
            return base.OnPrepareOptionsMenu(menu);
        }
开发者ID:slodge,项目名称:MonoDroid.ActionBar,代码行数:15,代码来源:ActionBarActivity.cs

示例4: OnPrepareOptionsMenu

        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            menu.Clear ();

            // Check if the toolbar is initialized, and if so, inflate the menu onto it
            if (_toolbar != null)
            {
                MenuInflater.Inflate (Resource.Menu.menu, menu);

                // Locate MenuItem with ShareActionProvider
                var item = menu.FindItem (Resource.Id.menu_item_share);

                // Fetch and store ShareActionProvider
                if (item != null)
                {
                    item.SetIntent (CreateShareIntent ());
                }

                var searchItem = menu.FindItem (Resource.Id.action_search);
                _searchView = (SearchView)MenuItemCompat.GetActionView (searchItem);

                _searchView.QueryTextChange += (sender, e) =>
                {
                    if (!string.IsNullOrEmpty (e.NewText))
                    {
                        // User has inputted some search text
                        SupportFragmentManager.BeginTransaction ()
                                                  .Replace (Resource.Id.content_frame, new SearchResultsFragment (e.NewText))
                                                  .Commit ();
                    }
                    else
                    {
                        // No search string, so display the previous fragment
                        SupportFragmentManager.BeginTransaction ()
                                              .Replace (Resource.Id.content_frame, _prevFragment)
                                              .Commit ();
                    }
                };
            }

            return base.OnPrepareOptionsMenu (menu);
        }
开发者ID:yonifra,项目名称:Shortie,代码行数:42,代码来源:MainActivity.cs

示例5: ClearInternal

 internal static void ClearInternal(IMenu menu)
 {
     if (menu == null)
         return;
     int size = menu.Size();
     for (int i = 0; i < size; i++)
         MenuItemTemplate.ClearInternal(menu.GetItem(i));
     menu.Clear();
     menu.ClearBindings(true, true);
 }
开发者ID:dbeattie71,项目名称:MugenMvvmToolkit,代码行数:10,代码来源:MenuTemplate.cs

示例6: OnPrepareOptionsMenu

		public override bool OnPrepareOptionsMenu(IMenu menu)
		{
			menu.Clear ();
			MenuInflater.Inflate(Resource.Menu.main, menu);
			return base.OnPrepareOptionsMenu(menu);
		}
开发者ID:kishoredbn,项目名称:Android,代码行数:6,代码来源:MainActivity.cs

示例7: OnPrepareOptionsMenu

        //Prepare the Screen's standard options menu to be displayed.
        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            //Prevent menu items from being duplicated.
            menu.Clear();

            MenuInflater.Inflate(Resource.Menu.menu, menu);
            return base.OnPrepareOptionsMenu(menu);
        }
开发者ID:alexhdevries,项目名称:DomoticaMLG,代码行数:9,代码来源:MainActivity.cs

示例8: OnPrepareOptionsMenu

		public override bool OnPrepareOptionsMenu(IMenu menu)
		{
			menu.Clear ();
			MenuInflater.Inflate(Resource.Menu.chat, menu);
			if (visibleMessages <= 15) {
				var item = menu.FindItem (Resource.Id.action_lessMessages);
				item.SetVisible (false);
				item = menu.FindItem (Resource.Id.action_defaultMessages);
				item.SetVisible (false);
			}
			return base.OnPrepareOptionsMenu(menu);
		}
开发者ID:kishoredbn,项目名称:Android,代码行数:12,代码来源:ChatActivity.cs

示例9: CreateMenu

        private static void CreateMenu(IMenu menu)
        {
            menu.Clear();

            if (BitBrowserApp.Current.Settings != null)
                menu.Add(Menu.First, 1, 1, D.PREFERENCES);

            menu.Add(Menu.First, 2, 2, D.EXIT);
#if DEBUG
            menu.Add(Menu.First, 3, 3, "Throw exception");
#endif
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:12,代码来源:BaseScreen.cs

示例10: OnCreateOptionsMenu

		public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
		{
			menu.Clear ();
			inflater.Inflate (Resource.Menu.menu_search, menu);
			base.OnCreateOptionsMenu (menu, inflater);
		}
开发者ID:edcombs,项目名称:StudyEspanol,代码行数:6,代码来源:FindView.cs

示例11: OnPrepareOptionsMenu

        /// <summary>
        /// Prepare the Screen's standard options menu to be displayed.
        /// </summary>
        /// <param name="menu">The options menu as last shown or first initialized by
        /// onCreateOptionsMenu().</param>
        /// <returns>
        /// To be added.
        /// </returns>
        /// <since version="Added in API level 1" />
        ///   <altmember cref="M:Android.App.Activity.OnCreateOptionsMenu(Android.Views.IMenu)" />
        /// <remarks>
        ///   <para tool="javadoc-to-mdoc">Prepare the Screen's standard options menu to be displayed.  This is
        /// called right before the menu is shown, every time it is shown.  You can
        /// use this method to efficiently enable/disable items or otherwise
        /// dynamically modify the contents.
        ///   </para>
        ///   <para tool="javadoc-to-mdoc">The default implementation updates the system menu items based on the
        /// activity's state.  Deriving classes should always call through to the
        /// base class implementation.</para>
        ///   <para tool="javadoc-to-mdoc">
        ///   <format type="text/html">
        ///   <a href="http://developer.android.com/reference/android/app/Activity.html#onPrepareOptionsMenu(android.view.Menu)" target="_blank">[Android Documentation]</a>
        ///   </format>
        ///   </para>
        /// </remarks>
        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            menu.Clear();
            MenuInflater.Inflate(Resource.Menu.ApplicationMenu, menu);
            IMenuItem item = menu.FindItem(Resource.Id.actionusername);
            if (ApplicationData.User.Username != null)
            {
                item.SetTitle(ApplicationData.User.Username);
            }

            return base.OnPrepareOptionsMenu(menu);
        }
开发者ID:JaipurAnkita,项目名称:mastercode,代码行数:37,代码来源:ActivityBase.cs

示例12: OnPrepareOptionsMenu

        public override bool OnPrepareOptionsMenu(IMenu menu)
        {
            menu.Clear();

            if (BitBrowserApp.Current.Settings != null)
                menu.Add(Menu.First, 1, 1, D.PREFERENCES);

            menu.Add(Menu.First, 2, 2, D.EXIT);
#if DEBUG
            menu.Add(Menu.First, 3, 3, "Throw exception");
#endif
            return base.OnPrepareOptionsMenu(menu);
        }
开发者ID:Fedorm,项目名称:core-master,代码行数:13,代码来源:BaseScreen.cs


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