searchview

How to dismiss keyboard in Android SearchView?

喜你入骨 提交于 2019-11-27 05:38:27
问题 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

SearchView.OnCloseListener does not get invoked

廉价感情. 提交于 2019-11-27 04:46:23
问题 Im using an action bar and adding a searchView to it. I have implemented the searchView.onCLoseListener but this does not seem to be getting invoked. Any suggestions ? My code looks something like this : SearchView searchView = new SearchView(getContext()); searchView.setOnCloseListener(new OnCloseListener() { public boolean onClose() { searchView.setVisibility(SearchView.GONE); // Do Something return true; } }); 回答1: I ran into same problem on android 4.1.1. Looks like it is a known bug:

How to move SearchView 's search Icon to the right side?

最后都变了- 提交于 2019-11-27 03:53:48
问题 Here is my layout, using android.support.v7.widget.SearchView . I want to move the search icon to the right side,but I haven't found any method... ` <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app

MenuItemCompat.setOnActionExpandListener deprecated

…衆ロ難τιáo~ 提交于 2019-11-27 02:48:06
问题 I have some code that sets a boolean if the search view is open or not. MenuItemCompat.setOnActionExpandListener(action_search, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item){ isSearch = true; return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item){ isSearch = false; return true; } }); It works. I'm happy with the way it responds. However, it it shows as deprecated, the setOnActionExpandListener is crossed

Creating a SearchView that looks like the material design guidelines

烂漫一生 提交于 2019-11-27 02:29:28
I'm currently in the process of learning how to convert my app to Material design and I'm a bit stuck right now. I've got the Toolbar added and I have made my navigation drawer overlay all the content. I'm now trying to create an expandable search that looks like the one in the material guidelines : This is what I've got right now and I can't figure out how to make it like the above: This is my menu xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action

Android appcompat toolbar stretches when searchview gets focus

时光总嘲笑我的痴心妄想 提交于 2019-11-27 00:56:11
问题 I'm updating an app to use the new Toolbar instead of the regular ActionBar . In my app the user must be able to select a contact from their contact list. To do so, I've added a SearchView to the menu. The contacts are already in the list; the SearchView is used to filter the list using the ArrayAdapter.getFilter() method. It all worked fine using the ActionBar , but the Toolbar 's height gets stretched to just behind the keyboard. Using the XML inspection from Android Device Monitor I can

How to build Gmail like search box in the action bar?

落花浮王杯 提交于 2019-11-27 00:31:19
问题 I am currently using SearchView widget inside ActionBarcompat to filter a list while searching. When the user starts entering text the ListView in the main layout updates with an Adapter to filter the results. I do this by implementing a OnQueryTextListener and filter the results on each key stroke. Instead, I want to create a Gmail like search box with auto suggest list generated and no changes to the underlying view I have went through this tutorial that uses the SearchView component but it

Turn AutoCompleteTextView into a SearchView in ActionBar instead

懵懂的女人 提交于 2019-11-26 23:54:59
问题 I have a AutoCompleteTextView which gives user auto-completion search result from Google Places API . Once I was done I discovered SearchView and how it can be placed in the ActionBar . I checked out the SearchView example provided by google and added it to my application as a starting point (it lists the installed applications) but I don´t know how to proceed from here. I want to have the same functionality as AutoCompleteTextView but use the SearchView instead. Any suggestion? The whole

Android: Providing recent search suggestions without searchable activity?

人走茶凉 提交于 2019-11-26 22:36:11
问题 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);

Creating a SearchView that looks like the material design guidelines

戏子无情 提交于 2019-11-26 22:14:13
问题 I'm currently in the process of learning how to convert my app to Material design and I'm a bit stuck right now. I've got the Toolbar added and I have made my navigation drawer overlay all the content. I'm now trying to create an expandable search that looks like the one in the material guidelines: This is what I've got right now and I can't figure out how to make it like the above: This is my menu xml: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk