怎么在Android Quick Search Box中添加自己的app,按照小弟我的意愿去Search(转载)

如何在Android Quick Search Box中添加自己的app,按照我的意愿去Search(转载)??????view plaincopy to cli

如何在Android Quick Search Box中添加自己的app,按照我的意愿去Search(转载)

??????view plaincopy to clipboardprint?

  1. <intent-filter>??
  2. ????<action?android:name="android.intent.action.SEARCH"?/>??
  3. ????<category?android:name="android.intent.category.DEFAULT"?/>??
  4. </intent-filter>??
  5. ??????????????
  6. <meta-data?android:name="android.app.searchable"??
  7. ???????android:resource="@xml/searchable"?/>??

?

???? 还需要公开自己的数据,供Quick Search Box 使用

?

view plaincopy to clipboardprint?
  1. <!--?Provides?search?suggestions?for?words?and?their?definitions.?-->??
  2. <provider?android:name="DictionaryProvider"??
  3. ???????android:authorities="dictionary"??
  4. ???????android:syncable="false"?/>??

?

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

?

view plaincopy to clipboardprint?
  1. <searchable?xmlns:android="http://schemas.android.com/apk/res/android"??
  2. ???????android:label="@string/search_label"??
  3. ???????android:searchSettingsDescription="@string/settings_description"??
  4. ???????android:includeInGlobalSearch="true"??
  5. ???????android:searchSuggestAuthority="dictionary"??
  6. ???????android:searchSuggestIntentAction="android.intent.action.VIEW">??
  7. </searchable>??

?

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


?? 在package/apps/QuickSearchBox/tests/下,还有三个有意思的app,可以直接添加到QuickSearchBox中。

? ? To run the tests use the command:
??? "adb shell am instrument -w com.android.quicksearchbox.tests/android.test.InstrumentationTestRunner"



?? 丰富一下QSB吧~

转载:http://blog.csdn.net/yiyaaixuexi/archive/2011/03/02/6218823.aspx

?

?

?