public override bool OnClose()
 {
     if (!TextUtils.IsEmpty(SearchViewCompat.GetQuery(mSearchView)))
     {
         SearchViewCompat.SetQuery(mSearchView, null, true);
     }
     return(true);
 }
Esempio n. 2
0
            public override void OnCreateOptionsMenu(IMenu menu, MenuInflater inflater)
            {
                // Place an action bar item for searching.
                var item = menu.Add("Search");

                item.SetIcon(Android.Resource.Drawable.IcMenuSearch);
                MenuCompat.SetShowAsAction(item, MenuItemCompat.ShowAsActionAlways);
                var searchView = SearchViewCompat.NewSearchView(Activity);

                if (searchView != null)
                {
                    SearchViewCompat.SetOnQueryTextListener(searchView, new MyOnQueryTextListenerCompat(this));
                    MenuItemCompat.SetActionView(item, searchView);
                }
            }
Esempio n. 3
0
            public override void OnCreateOptionsMenu(IMenu menu, MenuInflater Inflater)
            {
                // Place an action bar item for searching.
                IMenuItem item = menu.Add("Search");

                item.SetIcon(global::Android.R.Drawable.Ic_menu_search);
                MenuItemCompat.SetShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_ALWAYS
                                               | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
                View searchView = SearchViewCompat.NewSearchView(GetActivity());

                if (searchView != null)
                {
                    SearchViewCompat.SetOnQueryTextListener(searchView, new MyOnQueryTextListenerCompat(this));
                    MenuItemCompat.SetActionView(item, searchView);
                }
            }