Heiko Rupp Heiko Rupp - 3 years ago 91
Android Question

How to add a drop down next to the search input field in Android?

In the system-wide search on my HTC Desire (Froyo), I see a little drop down left to the search input field that allows to select where I want to search (All, web, apps).

How can I implement this in an application of mine? The search tutorial on the Google developer site does not address this.

So in a scenario like the following, taken from the Android docs,

I would like to click on the books and then get some sort of menu to e.g. select "words", "headings" as search mode.

Update: I am not looking for the QuickAction dialog itself, but rather how to attach something to the books icon that reacts on touch, so that I could attach the QuickAction or a new activity or ... And I want to use the standard Android Search Dialog as described in http://developer.android.com/guide/topics/search/search-dialog.html

Answer Source

You can't modify the system's search dialog. So if you want customizations like making a drop-down menu appear when the user touches the icon, you'll have to implement your own dialog. This would make your search non-standard so I wouldn't advise it.

However, if I can't talk you out of it, you can see how Android's built-in search dialog is implemented here:

In Android 3.x this gets a little easier with the introduction of the SearchView class.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download