Questions tagged [searchview]

is an Android GUI widget that provides a user interface for the user to enter a search query and submit a request to a search provider

SearchView is an Android GUI widget that provides a user interface for the user to enter a search query and submit a request to a search provider.

SearchView was added in API level 11 (Android 3.0).

2211 questions
371
votes
13 answers

How to filter a RecyclerView with a SearchView

I am trying to implement the SearchView from the support library. I want the user to be to use the SearchView to filter a List of movies in a RecyclerView. I have followed a few tutorials so far and I have added the SearchView to the ActionBar, but…
142
votes
11 answers

MenuItemCompat.getActionView always returns null

I just implemented the v7 AppCompat support library but the MenuItemCompat.getActionView always return null in every Android version I tested (4.2.2, 2.3.4 ....) The SearchView is displayed in action bar but it doesn't respond to touch actions and…
Mohsen Afshin
  • 13,273
  • 10
  • 65
  • 90
142
votes
38 answers

Is it possible to change the textcolor on an Android SearchView?

The SearchView element doesn't have any properties for changing the text color. The default text color is black and doesn't work on our dark background. Is there a way to change the color of the text without resorting to hacks? I found this similar…
CACuzcatlan
  • 5,407
  • 8
  • 41
  • 59
141
votes
8 answers

Creating a SearchView that looks like the material design guidelines

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…
Mike
  • 2,593
  • 3
  • 16
  • 20
132
votes
6 answers

How to use SearchView in Toolbar Android

The code on which I am working, is using a Toolbar and inflating a menu. Here is the code private Toolbar mToolbar; mToolbar.inflateMenu(R.menu.chat_screen_menu); setupMenu (); private void setupMenu () { mMenu = mToolbar.getMenu(); if…
Shudy
  • 7,806
  • 19
  • 63
  • 98
126
votes
12 answers

Changing the background drawable of the searchview widget

I'm trying to change the drawable that sits in the Android actionbar searchview widget. Currently it looks like this: but I need to change the blue background drawable to a red colour. I've tried many things short of rolling my own search widget,…
Martyn
  • 16,432
  • 24
  • 71
  • 104
104
votes
5 answers

how to change android SearchView text

Is there a setText() method for SearchView or something like that? I try to set the search text in the searchView like this but there is no method for like this. searchView.setText(searchToken);
Khaled Annajar
  • 15,542
  • 5
  • 34
  • 45
92
votes
11 answers

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

I am using the Toolbar search widget in my project. Everything works fine but expect the thing which I am completely stuck up with removing the underline below the search field in my toolbar. I have tried many solutions and nothing works out. Below…
Chandru
  • 5,954
  • 11
  • 45
  • 85
87
votes
13 answers

How do I capture SearchView's clear button click?

How can I capture the event of user click on clear SearchView text by clicking on the X button on the right I already captured onQueryTextChange event but, this is for any text change not for that X button
asmgx
  • 7,328
  • 15
  • 82
  • 143
83
votes
4 answers

Implementing SearchView in action bar

I need to create SearchView from my arrayList and show the suggestions in the drop-down list same this I look for tutorials that explain step by step how to build a SearchView in a action bar. I have read the documentation and following…
Matteo
  • 1,241
  • 2
  • 21
  • 28
82
votes
15 answers

How do I close a SearchView programmatically?

I currently have a SearchView in the action bar of my app. When I click the search icon, the SearchView expands and the keyboard pops up as expected. Clicking the "X" in the SearchView box closes the SearchView as expected. However, when the…
Tim
  • 1,115
  • 1
  • 9
  • 12
71
votes
16 answers

How to dismiss keyboard in Android SearchView?

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…
CACuzcatlan
  • 5,407
  • 8
  • 41
  • 59
67
votes
9 answers

Cannot get searchview in actionbar to work

I am pretty new to java and android development; and I have been working on an app in which I want an action bar with a SearchView. I have looked at the google examples but I can not get it to work. I must be doing something wrong and I'm about to…
Jonathan Andersson
  • 1,057
  • 1
  • 10
  • 19
57
votes
7 answers

Implementing SearchView as per the material design guidelines

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…
50
votes
14 answers

Android - Make whole search bar clickable

I am using a search-view element in my fragment to implement search feature.
Saran
  • 953
  • 2
  • 10
  • 15
1
2 3
99 100