public override bool OnCreateOptionsMenu(IMenu menu) { MenuInflater inflater = MenuInflater; inflater.Inflate(Resource.Menu.group, menu); var searchManager = (SearchManager)GetSystemService(Context.SearchService); IMenuItem searchItem = menu.FindItem(Resource.Id.menu_search); var view = MenuItemCompat.GetActionView(searchItem); searchView = view.JavaCast <Android.Support.V7.Widget.SearchView>(); searchView.SetSearchableInfo(searchManager.GetSearchableInfo(ComponentName)); searchView.SetOnSuggestionListener(new SuggestionListener(searchView.SuggestionsAdapter, this, searchItem)); searchView.SetOnQueryTextListener(new OnQueryTextListener(this)); if (_prefs.GetBoolean("ActivateSearchView", false) && AppTask.CanActivateSearchViewOnStart) { //need to use PostDelayed, otherwise the menu_lock item completely disappears searchView.PostDelayed(() => { searchView.Iconified = false; AppTask.CanActivateSearchViewOnStart = false; }, 500); } ActionBar.LayoutParams lparams = new ActionBar.LayoutParams(ActionBar.LayoutParams.MatchParent, ActionBar.LayoutParams.MatchParent); searchView.LayoutParameters = lparams; _syncItem = menu.FindItem(Resource.Id.menu_sync); _offlineItem = menu.FindItem(Resource.Id.menu_work_offline); _onlineItem = menu.FindItem(Resource.Id.menu_work_online); UpdateOfflineModeMenu(); return(base.OnCreateOptionsMenu(menu)); }