关于系统APP:QuickSearchBox,怎么增加搜索类别

关于系统APP:QuickSearchBox,如何增加搜索类别
首页不是有一个Google搜索框吗,点击这个搜索框进去以后是QuickSearchBox,点击搜索选项按钮后,出现:全部,网页,应用程序,联系人4张图片可供选择,我想在这里面再增加一张图片,然后把这张图片的链接,定向到我自己的APP里面去,不修改QuickSearchBox的代码,只在自己的APP里设置,有办法吗,QuickSearchBox好多代码啊。

------解决方案--------------------
本帖最后由 yiyaaixuexi 于 2011-11-01 13:24:48 编辑
我以development/samples/SearchDictionary为例

1.在自己的app的AndroidManifest.xml中,需要对intent 和 res/xml/searchable.xml 进行注册:

<intent-filter>
    <action android:name="android.intent.action.SEARCH" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
            
<meta-data android:name="android.app.searchable"
       android:resource="@xml/searchable" />


2.公开自己的数据,供Quick Search Box 使用

<!-- Provides search suggestions for words and their definitions. -->
<provider android:name="DictionaryProvider"
       android:authorities="dictionary"
       android:syncable="false" />


3.在res/xml/searchable.xml中,要注意searchSuggestAuthority和AndroidManifest.xml中的要对应上

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
       android:label="@string/search_label"
       android:searchSettingsDescription="@string/settings_description"
       android:includeInGlobalSearch="true"
       android:searchSuggestAuthority="dictionary"
       android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable>


4.  编译生成apk推入,先在Search setting中手动勾选上自己的应用选项,就可以了。