public override void OnCreateOptionsMenu(Android.Views.IMenu menu, Android.Views.MenuInflater inflater) { var menuItem = menu.Add(0, MENU_CANCEL_SEARCH_ID, 0, new Java.Lang.String("")); menuItem.SetIcon(Resource.Drawable.abc_ic_clear_material); menuItem.SetShowAsAction(Android.Views.ShowAsAction.Always); }
public override void OnCreateOptionsMenu(Android.Views.IMenu menu, Android.Views.MenuInflater inflater) { var menuItem = menu.Add(0, CLEAR_ID, 0, new Java.Lang.String(LocalizationService.GetLocalizableString(FiltersConstants.RESX_NAME, "Selection_Clear"))); menuItem.SetShowAsAction(Android.Views.ShowAsAction.Always); menuItem.SetActionView(Resource.Layout.app_filters_filters_clearButton); menuItem.ActionView.Click += (sender, e) => { ViewModel?.ClearCommand.Execute(null); }; }
public override void OnCreateOptionsMenu(Android.Views.IMenu menu, Android.Views.MenuInflater inflater) { var config = Mvx.Resolve <IProductConfigService>().Config; if (ViewModel?.CartIndicatorVM != null) { var cartIndicatorType = config.Basket.CartIndicator.TypeName; var viewLookupService = Mvx.Resolve <IViewLookupService>(); if (viewLookupService.IsRegistered(cartIndicatorType)) { if (Activator.CreateInstance(viewLookupService.Resolve(cartIndicatorType), Context) is IMvxAndroidView cartIndicatorView) { cartIndicatorView.BindingContext = new MvxAndroidBindingContext(Context, new MvxSimpleLayoutInflaterHolder(LayoutInflater), ViewModel.CartIndicatorVM); var menuItem = menu.Add(0, MENU_CARD_INDICATOR_ID, 0, new Java.Lang.String("")); menuItem.SetShowAsAction(Android.Views.ShowAsAction.Always); menuItem.SetActionView(cartIndicatorView as Android.Views.View); } } } if (ViewModel != null && ViewModel.SearchEnabled && !ViewModel.SearchBar && config.SearchType != SearchType.Disabled) { var menuItem = menu.Add(0, MENU_SEARCH_ID, 0, new Java.Lang.String("")); var typedValue = new TypedValue(); Activity.Theme.ResolveAttribute(Resource.Attribute.app_products_ic_toolbar_search, typedValue, true); try { var drawable = Activity.Resources.GetDrawable(typedValue.ResourceId, Activity.Theme); menuItem.SetIcon(drawable); } catch { MvxTrace.Trace(() => $"Not found drawable resource by id: {typedValue.ResourceId}"); } menuItem.SetShowAsAction(Android.Views.ShowAsAction.Always); } }
public override void OnCreateOptionsMenu(Android.Views.IMenu menu, Android.Views.MenuInflater inflater) { Toast.MakeText(Activity, "Created nested fragment's menu.", ToastLength.Short).Show(); inflater.Inflate(Resource.Menu.display_options_actions, menu); base.OnCreateOptionsMenu(menu, inflater); }
public override void OnCreateOptionsMenu(Android.Views.IMenu menu, Android.Views.MenuInflater inflater) { MenuItemCompat.SetShowAsAction(menu.Add(new Java.Lang.String("Menu 2")), (int)Android.Views.ShowAsAction.IfRoom); }