3

Note: I have seen this and this question, and my question is not their duplicate (They do not solve my confusion).

From the Android Material Design specification for search,

The search text field is presented inside of an inset search box, ready to receive focus.

and this picture is shown:

enter image description here

They have also shown this kind of SearchViews at many different places in the material design specification e.g. here

But I can't locate a guide/tutorial describing how to make something like this. From my web search, I have found this SO answer, but they are using an EditText and ImageView, they are not even using a SearchView widget.

The biggest question in this case is that what about the Search Framework the Android API's provide, which is explained in this guide. This builtin search framework provides a very easy way to implement all the functionality associated with providing Search in an app, i.e. it provides a way to integrate our search with the Android system so that the system handles the user's search queries into SearchView, delivers them to the Searchable Activity, provides a way to add the voice search and search suggestions functionality, etc.

So now in order to use the Material design "inset search box", do we have to write code to handle user input into the SearchView/EditText, enable voice search, recent suggestions and suggestions from app's data? or is there a way to integrate the EditText (we are using as the search widget) with the system to have assisted search?

Community
  • 1
  • 1
Solace
  • 8,612
  • 22
  • 95
  • 183
  • 2
    *Do we have to implement that entire functionality ourselves?* no, as we all know the implementation is done by small dwarfs – Selvin Aug 06 '15 at 17:13
  • @Selvin Well, [from the guide](http://developer.android.com/guide/topics/search/search-dialog.html): " If you want, you can handle all user input into the search widget yourself, using various callback methods and listeners. This document, however, focuses on how to integrate the search widget with the system for an assisted search implementation." – Solace Aug 06 '15 at 17:54
  • @Selvin ...So what I am asking is that to implement the Material Design's Search box, do I have to write code to handle all the input into the EditText/SearchView, instead of just writing the code to integrate the search widget with the system for an _assisted_ search implementation. – Solace Aug 06 '15 at 17:54
  • Implement toolbar put searchview there... It has similar "events" like EditText... On something like textchange filter the adapter... Really not big deal... – Selvin Aug 06 '15 at 17:57
  • @Selvin If Ican't get the `SearchView` integrated with the system for the _assisted_ search, I will go with the `EditText`, because I don't like the line below the default appearance of the `SearchView` and the icon inside it. Previously we used to set up a searchable configuration file, declare a searchable activity and the manifest, handle the intent carrying the query inside this activity, and bam! The system did the rest. Now, I have to handle I-don't-know-how-many kinds (onTouch, onQueryTextChanged, suggestions recent n other ones, voice search) of events. This does sound like a BIG deal. – Solace Aug 06 '15 at 18:17

0 Answers0