如何添加一个下拉旁边的Andr​​oid搜索输入字段? [英] How to add a drop down next to the search input field in Android?

查看:95
本文介绍了如何添加一个下拉旁边的Andr​​oid搜索输入字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的HTC Desire(升级Froyo)系统范围内的搜索,我看到一个小下拉留给了搜索输入字段,允许选择,我想搜索(全部,网络,应用程序)。

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.

因此​​,在类似下面的场景,从Android文档拍摄,

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.

更新:我不是在寻找QuickAction对话本身,而是如何连接东西的书籍图标反作用于触摸,这样我就可以装上QuickAction或新活动或。 ..我想使用标准的Andr​​oid搜索对话框中 HTTP: //developer.android.com/guide/topics/search/search-dialog.html

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

推荐答案

您不能修改系统的搜索对话框。所以如果你想喜欢做,当用户触摸图标下拉菜单中出现的自定义,你必须实现自己的对话框。这将使你的搜索非标准的,所以我不会建议吧。

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.

不过,如果我不能谈论它,你出来,你可以看到Android的内置搜索对话框在这里实现:

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

在的Andr​​oid 3.X这得到引进的SearchView类的更容易一些。

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

这篇关于如何添加一个下拉旁边的Andr​​oid搜索输入字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆