searchview

How to dismiss keyboard in Android SearchView?

夙愿已清 提交于 2019-11-27 19:57:50
I have a searchView in the ActionBar. I want to dismiss the keyboard when the user is done with input. I have the following queryTextListener on the searchView final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { // Do something return true; } @Override public boolean onQueryTextSubmit(String query) { showProgress(); // Do stuff, make async call getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); return true; } }; Based on similar questions, the following

How to remove white underline in a SearchView widget in Toolbar Android

拥有回忆 提交于 2019-11-27 18:57:20
I am using Toolbar search widget in my project. Everything works fine but expect the thing which I am completely stuck up with removing the underline below search field in my toolbar. I have tried many solutions and nothing works out. Below are the some of the solutions what i tried. Requirement is to remove white underline in the image Ist Solution: //Removing underline int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_plate", null, null); View searchPlate = searchView.findViewById(searchPlateId); if (searchPlate!=null) { searchPlate

SearchView Suggestion doesn't work with one character

喜夏-厌秋 提交于 2019-11-27 18:09:36
问题 I have a problem with my SearchView Suggestion, when I write one character in the SearchView the Suggestion doesn't come. But when I write two characters in the EditText of my SearchView the Suggestion will come. So I want that my Suggestion already come when I write one character in the EditText of my SearchView , what can I do? My Code from MainActivity: private SearchView mSearchView; private SimpleCursorAdapter mAdapter; private ArrayList<String> mList; @Override protected void onCreate

SearchView like Google Play Video App

久未见 提交于 2019-11-27 18:04:04
问题 I'm trying to implement search interface in actionbar like in Google Play Video App (https://play.google.com/store/apps/details?id=com.google.android.videos). I think it is SearchView widget but don't understand how do same customization: add up button inside it, set background, and expand the full width of actionbar 回答1: @Quiny898 create a nice lib, have a look: https://github.com/Quinny898/PersistentSearch 回答2: Use a standalone Toolbar and set it with an elevation, then inflate your menu in

Android: Providing recent search suggestions without searchable activity?

懵懂的女人 提交于 2019-11-27 17:37:58
I have an ActionBar SearchView and I am successfully able to make searches with it. The android documentation does not explain how to implement search suggestions. I do not want to have a searchable activity. This is my search code: public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_add_song, menu); final SearchView searchView = (SearchView) menu.findItem(R.id.song_search).getActionView(); searchView.setFocusable(true); searchView.setIconified(false); final AddSongActivity activity = this; searchView.setOnQueryTextListener(new SearchView

Implementing SearchView as per the material design guidelines

余生长醉 提交于 2019-11-27 16:40:33
I have been looking for ways to implement a searchview in the activity toolbar (actionbar) as per the material design guidelines. On clicking on the search icon, the entire toolbar animates to have only the search EditText with white background with suggestions appearing in the main view instead of a drop down. Here is a screenshot from the guidelines: Here is a gif from the Gmail Inbox implementation: I have been looking for code examples and tutorials but so far I have been unsuccesful. How do I go about doing this? shnizlon I tried several material SearchView libraries, but none of them

SearchView in expanded mode doesn't hide all action bar icons starting from Marshmallow

♀尐吖头ヾ 提交于 2019-11-27 16:29:40
SearchView looks fine on Lollipop devices (Android 21): But on Android 23-28 it doesn't hide all icons on the right side: <item android:id="@+id/action_search" android:title="@string/search" app:actionViewClass="androidx.appcompat.widget.SearchView" app:showAsAction="ifRoom"/> <item android:id="@+id/action_sort" android:title="@string/sorting" android:icon="@drawable/sort" app:showAsAction="ifRoom"/> How can I fix it? Update Seems Android 23 and higher don't hide icons anymore on the right (because there is enough space) But it only works fine if you don't have home button or hamburger menu on

SearchView edittext is always null

此生再无相见时 提交于 2019-11-27 16:18:48
问题 I always get that textView is null when doing this: public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); MenuItem searchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat .getActionView(searchItem); int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null); TextView textView = (TextView) searchView.findViewById(id); textView.setTextColor(Color.WHITE); } Anyone know

android searchview setOnActionExpandListener on Honeycomb 3.2

泄露秘密 提交于 2019-11-27 16:07:55
问题 I'm developing an app for Android 3.2 and greater with android-support-v4 . I need to implement OnActionExpandListener for "intercept" when SearchView in the actionbar is expanded and when is collapsed. My code for Android 4.0 and higher it's ok, but for 3.2 no. menu.xml <item android:id="@+id/menu_search" android:title="@string/menu_search" android:icon="@android:drawable/ic_menu_search" android:showAsAction="collapseActionView|always" android:actionViewClass="android.widget.SearchView" />

How to remove android searchview popup text while searching?

柔情痞子 提交于 2019-11-27 14:44:53
问题 I have implemented action bar SearchView , it's working fine but at the bottom of the screen a floating text popup is shown. See screenshot: ListView Java class: @Override public boolean onQueryTextChange(String newText) { if (TextUtils.isEmpty(newText)) { mListView.clearTextFilter(); } else { // EventAdapterView ca = (EventAdapterView)mListView.getAdapter(); // ca.getFilter().filter(newText.toString()); // Filter lFilter = mDataAdapter.getFilter(); // lFilter.filter(""); // following line