searchview

How to make SearchView lose focus and collapse when clicking elsewhere on activity

≡放荡痞女 提交于 2019-12-03 17:47:56
问题 In my app, I'm making a search interface in which the SearchView collapses and expands when it loses and gains focus respectively. However, the losing focus thing is only happening in two cases: When the back button is pressed. When the home icon beside the SearchView is pressed. I want it to lose focus (and hence collapse) if the user clicks not only on these two things, but anywhere else on the screen (e.g., any button or any blank portion of the screen without a view on it). 回答1: Well I

SearchView is invisible with collapseActionView parameter since 24.1 design library

旧街凉风 提交于 2019-12-03 15:55:53
I encountered a problem since I updated the Android Design Library from 23.4.0 to 24.1.1 My SearchView was defined like this : <item android:id="@+id/action_search" android:icon="@drawable/ic_search" android:title="@string/title_action_search" app:actionViewClass="android.support.v7.widget.SearchView" app:showAsAction="collapseActionView|ifRoom" /> But my SearchView input became invisible (I can write in it, but the text, or hint does not appear). I described it in the following picture with 3 different steps : If I remove the "collapseActionView" parameter, it works fine, but the searchInput

Delay call to onQueryTextChange() in SearchView.OnQueryTextListener with SearchView

夙愿已清 提交于 2019-12-03 15:54:25
问题 Using a SearchView in my application. Is there anyway in which I can make the call to onQueryTextChange() method delayed. Like, when user type a sequence of characters, he must wait before this method gets called. This wait should not depend on number of characters typed yet but a small pause is required before method being hit. I want to pause because, as the user types into the search view, a request with the string will be made to server to request the matched data, and then I will

Android SearchView Icon

我的梦境 提交于 2019-12-03 15:44:19
问题 I want to disable the Mag icon displayed inside the search view component. Any idea how to reference it and remove it or replace it with another drawable ? 回答1: In your theme: <style name="Theme" parent="Your parent theme"> <item name="android:searchViewSearchIcon">@android:drawable/ic_search</item> </style> Edit: searchViewSearchIcon is a private attribute. This answer therefore does not work (on the native ActionBar). 回答2: Since the wording of the question does not contain any mention of

Android SearchView empty string

筅森魡賤 提交于 2019-12-03 14:25:26
问题 I'm trying to use a SearchView and I got everything to work, except when I want to search an empty string. The onQueryTextChange does react when I remove the last character, but I want the user to be able to press the search button when the searchfield is empty. final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { // Do something return true; } @Override public boolean onQueryTextSubmit

Is there any listener on Android SearchView to notify if SearchView is expanded and ready to take input?

梦想与她 提交于 2019-12-03 12:17:17
I want to show some default suggestions in SearchView when User hasn't typed anything. I am setting my custom suggestion adapter manually using matrix cursor. I tried setting adapter in onFocusChange and onClickListner but suggestions get hidden behind a keyboard, apparently suggestions are loading earlier than keyboard. I did not find any listener which tells me that searchview is completely loaded with keyboard in the view. Help me in finding the right solution or any workaround. I have tried a workaround postDelayed but it's not smooth experience. I have this code inside onCreateOptionsMenu

How to get input from searchview to textview

孤街醉人 提交于 2019-12-03 12:02:32
Is there another way to get the input of searchview and put it into textview? It seems that the getText() and setText() method are not applicable to searchview. Or Is there a way to transfer the input from EditText to Searchview? Please help me to look for necessary resources/codes/method about the above question. Thank you. Here is my code: public boolean onQueryTextChange(String newText) { // TODO Auto-generated method stub showResults(newText); return false; } @Override public boolean onQueryTextSubmit(String query) { // TODO Auto-generated method stub tvInput = (TextView) findViewById (R

Styling android search view and drop down list in actionbar

微笑、不失礼 提交于 2019-12-03 11:40:32
问题 In my app, I have a searchview that displays search suggestions. I want the dropdown/spinner and text to be a particular color. Currently the only change I've been able to make is the text color of the inputted text via the following: <style name="MyApp.AutoCompleteTextView" parent="Widget.AppCompat.Light.AutoCompleteTextView"> <item name="android:textColor">@color/white</item> <item name="android:textCursorDrawable">@null</item> <item name="android:background">@color/myBackgroundColor</item>

Firebase searching by character

为君一笑 提交于 2019-12-03 10:14:55
问题 I am using FirebaseRecyclerAdapter in my firebase app and I am still till now didn't know how to search in Firebase by character, I have already used an query and I have got a good result but its not usable, here's my database I want to search in: And here's my method that I use it but it get the "Username" if I enter full name only so if I write "m" nothing show: mMainSearcher.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String

Searchview not showing in Toolbar

孤街浪徒 提交于 2019-12-03 09:47:41
问题 I have actually a problem with my Searchview on the Support AppCompat v7 lib 24.0.0. The SearchView is not shown up no text and input text (look screenshot) The searchquery work perfect. Thats my menu <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=".MainActivity"> <item android:title="@string/search" android:id="@+id/action_search" android:icon="@drawable/ic