public override bool OnCreateOptionsMenu(IMenu menu) { MenuInflater.Inflate(Resource.Menu.optionmenu, menu); menuitem = menu.FindItem(Resource.Id.action_search); var test = new SearchView(this); menuitem.SetActionView(test); var searchView = MenuItemCompat.GetActionView(menuitem); int searchImgId = Resources.GetIdentifier("android:id/search_button", null, null); ImageView v = (ImageView)searchView.FindViewById(searchImgId); //v.SetImageResource(Resource.Drawable.abc_ic_search); _searchView = searchView.JavaCast <SearchView>(); setSearchIcons(_searchView); _searchView.QueryTextChange += (s, e) => { var searchFor = e.NewText.ToLower(); if (!String.IsNullOrEmpty(searchFor)) { //Console.System.Diagnostics.Debug.WriteLine("searchFor:" + searchFor); // find matches, IndexOf means look for the input anywhere in the items // but it isn't case-sensitive by default! var matches = (from i in _approvalList where i.POID.ToLower().Contains(searchFor) select i).ToList(); //foreach (var match in matches) { //matchList.Add (match); //} ApprovalDetailList list = new ApprovalDetailList(this); matches.ForEach(model => list.Add(model)); _approvalListAdapter.SetData(list); _approvalListAdapter.NotifyDataSetChanged(); //if (_searchListView.Visibility == ViewStates.Gone && _searchView.Iconified == false) //{ // //_searchListView.Visibility = ViewStates.Visible; // _searchView.Iconified = true; //} } else { _approvalListAdapter.SetData(_approvalList); _approvalListAdapter.NotifyDataSetChanged(); } }; _searchView.SetOnQueryTextFocusChangeListener(new CustomSearchViewOnFocusChangeListenter(this)); _searchView.SetOnSearchClickListener(new CustomSearchviewclicklistener(rltitle)); _searchView.SetOnCloseListener(new CustomSearchViewOnCloseListenter(rltitle, _approvalListAdapter, _approvalList)); return(base.OnCreateOptionsMenu(menu)); }