本文整理汇总了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();
};
}
示例2: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu(IMenu menu)
{
base.OnCreateOptionsMenu(menu);
MenuInflater inflater = new MenuInflater(this);
inflater.Inflate(Resource.Layout.XmlMenu, menu);
return true;
}
示例3: OnCreateOptionsMenu
public override bool OnCreateOptionsMenu(IMenu menu)
{
MenuInflater menuInflater = new Android.Views.MenuInflater(this);
menuInflater.Inflate(Resource.Layout.MenuNewsDetails, menu);
return true;
}
示例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);
}
示例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);
}
示例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();
}
示例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) => {};
}
示例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);
}
示例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);
}
示例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 ();
}
示例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);
}
示例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?");
}
}
示例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);
}
示例14: OnCreateOptionsMenu
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater menuInflater)
{
menuInflater.Inflate(Resource.Menu.menu_sessions, menu);
}
示例15: OnCreateOptionsMenu
public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
{
inflater.Inflate(Resource.Menu.calendar_display_modes, menu);
}