本文整理汇总了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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例6: OnPrepareOptionsMenu
public override bool OnPrepareOptionsMenu(IMenu menu)
{
menu.Clear ();
MenuInflater.Inflate(Resource.Menu.main, menu);
return base.OnPrepareOptionsMenu(menu);
}
示例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);
}
示例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);
}
示例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
}
示例10: OnCreateOptionsMenu
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
menu.Clear ();
inflater.Inflate (Resource.Menu.menu_search, menu);
base.OnCreateOptionsMenu (menu, inflater);
}
示例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);
}
示例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);
}