searchview

SearchView.isFocused always returns false

≯℡__Kan透↙ 提交于 2019-12-12 20:34:01
问题 I'm trying to determine whether a SearchView in the ActionBar is focused. But when I call SearchView.isFocused() I always get false as a result, even when the view is really focused (there is a cursor inside, and the soft keyboard is shown). How can I check, whether a SearchView is focused? 回答1: After some researching, I learned that SearchView.isFocused() always returns false because it's some child of the SearchView who really has the focus, not the SearchView itself. So I use the following

How to show search view recent search history

﹥>﹥吖頭↗ 提交于 2019-12-12 17:16:26
问题 I tried to using following ways but unable to show recent search history Create "history" to SearchView on ActionBar Implementing SearchView in action bar kindly help how to create and show recent search in serachview searchable xml 回答1: These are step i am using Searchable xml file <?xml version="1.0" encoding="utf-8"?> <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/app_label" android:hint="@string/search_hint" android:searchSuggestAuthority=

void android.support.v7.widget.SearchView.setOnQueryTextListener(android.support.v7.widget.SearchView$OnQueryTextListener)

こ雲淡風輕ζ 提交于 2019-12-12 13:32:45
问题 I am doing SearchView on CustomAdapter where it will search Gate Name. After i try run the app, it suddenly crash and give me the error as stated above. I do not know which part did i even do wrong that cause this issue to appear everytime i try to run my app. MainActivity.java @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_menu, menu); MenuItem searchItem = menu.findItem(R.id.item_search); SearchView searchView = (SearchView) searchItem

couldn't change actionbarsherlock SearchView icon

孤街醉人 提交于 2019-12-12 11:46:27
问题 When I use following configuration: <item android:id="@+id/menu_item_search" android:actionViewClass="com.actionbarsherlock.widget.SearchView" android:icon="@android:drawable/ic_menu_search" android:showAsAction="ifRoom" android:title="@string/action_search"/> ActionBarSherlock SearchView doesn't react on provided android:icon but in case of android:showAsAction="ifRoom|collapseActionView" icon is changed correctly but close button inside search view is absent. How to change search icon and

not able to implement the filter in SearchView. (SearchView+ FirebaseRecyclerAdapter)

▼魔方 西西 提交于 2019-12-12 11:23:48
问题 I am using the FirebaseRecyclerAdapter of Firebase-UI. I'm not able to implement the filter in SearchView. My database: My Question: How to search in FirebaseDatabase by character using FirebaseRecyclerAdapter ? (I want to search by username) My Code: I used this method for search, what's wrong in my code? mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean

SearchView gains focus and opens keyboard when returning from another activity

安稳与你 提交于 2019-12-12 10:31:00
问题 When I return from another activity to the main activity, the searchView gains focus and the keyboard opens, I managed to stop the keyboard from opening by using: getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); but this is not sufficient, if the actionbar drop down menu is opened and closed the keyboard reappears, because the searchView still has focus (remember I only closed the keyboard). I have tried to get a reference to the searchView and make it

Android Search menu item disappears when pressing back button/collapsing search field

岁酱吖の 提交于 2019-12-12 09:46:33
问题 I'm using android SearchView to have a search button in my action bar. I followed this tutorial from Google Developers on YouTube, and added a few tweaks based on my own needs. However, whenever I exit the search field that comes up when clicking the button, the search button disappears! Here is my onCreateOptionsMenu and onOptionsItemSelected functions onCreateOptionsMenu: @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it

Android - SearchView in toolbar not expanding

微笑、不失礼 提交于 2019-12-12 08:36:14
问题 I'm trying to add a SearchView in my toolbar, I've added the icon, but when I press it, it's not expanding. Here's the code: main_menu.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" tools:context="com.app.try.MainActivity"> <item android:id="@+id/search" android:title="@string/search" android:icon="@drawable/abc_ic_search_api_mtrl_alpha" app:showAsAction="always" android

App with SearchView crashing on restore

不羁岁月 提交于 2019-12-12 03:56:35
问题 I'm developing app with SearchView. When I open the search view, pressing "Home" and restoring application with "Don't keep activities" option enabled, it crashes with exception: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.github.ndczz.searchviewtest, PID: 20393 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.github.ndczz.searchviewtest/com.github.ndczz.searchviewtest.MainActivity}: java.lang.RuntimeException: Parcel android.os.Parcel@42e2e0b: Unmarshalling

RecyclerView not populated until SearchView interaction

南笙酒味 提交于 2019-12-12 03:36:45
问题 I'm facing an issue with my recyclerview, which has a custom adapter. Issue is that when the activity opens, recyclerview is empty. When user types anything on SearchView's text field, recyclerview gets populated and stays populated without any problems. I tried to change place of some code to fix this issue, yet no success. I've added the current and desired state screenshots below the codes. Thanks in advance. AddCourseActivity: public class AddCourseActivity extends AppCompatActivity{