本文整理汇总了C#中Android.Views.MenuInflater类的典型用法代码示例。如果您正苦于以下问题:C# MenuInflater类的具体用法?C# MenuInflater怎么用?C# MenuInflater使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MenuInflater类属于Android.Views命名空间,在下文中一共展示了MenuInflater类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
};
}
示例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
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();
};
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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) => {};
}
示例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);
}
示例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 ();
}
示例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);
}