private void SetupBottomToolbar() { var bottomToolbar = FindViewById <Toolbar>(Resource.Id.add_post_bottom_toolbar); _actionMenuView = bottomToolbar?.FindViewById <ActionMenuView>(Resource.Id.add_post_bottom_toolbar_actionmenu); if (_actionMenuView != null) { MenuInflater.Inflate(Resource.Menu.add_post_bottom, _actionMenuView.Menu); _actionMenuView.MenuItemClick += ActionMenuViewOnMenuItemClick; } }
protected override void OnDestroy() { base.OnDestroy(); // Remove handlers ViewModel.AfterPostAction = null; ViewModel.StartPosting -= ViewModelOnStartPosting; ViewModel.StopPosting -= ViewModelOnStopPosting; _actionMenuView.MenuItemClick -= ActionMenuViewOnMenuItemClick; _addPostMenuItem = null; _toolbarProgressbar = null; _actionMenuView = null; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.CSItemList, container, false); MenuView = view.FindViewById <Android.Support.V7.Widget.ActionMenuView>(Resource.Id.MenuView); ItemListView = view.FindViewById <ListView>(Resource.Id.ItemListView); MenuView.MenuItemClick += MenuView_MenuItemClick; MenuView.Menu.Add("Test"); return(view); } catch (Exception Ex) { WriteErrorLog(Ex); return(null); } }
public void AddSearchToToolBar() { _toolBar.Title = "XamControls"; //Element.Title; //_toolBar.Menu.GetItem(0).SetIcon(); InitializeSearchView(); if (_toolBar?.GetChildAt(1) is AppCompatTextView) { actionMenuView = (Android.Support.V7.Widget.ActionMenuView)_toolBar?.GetChildAt(0); appCompatTextView = (AppCompatTextView)_toolBar?.GetChildAt(1); appCompatImageButton = (AppCompatImageButton)_toolBar?.GetChildAt(2); } else { actionMenuView = (Android.Support.V7.Widget.ActionMenuView)_toolBar?.GetChildAt(0); appCompatImageButton = (AppCompatImageButton)_toolBar?.GetChildAt(1); appCompatTextView = (AppCompatTextView)_toolBar?.GetChildAt(2); } }