1: <?xml version="1.0" encoding="utf-8"?>
2: <searchable xmlns:android="http://schemas.android.com/apk/res/android"
3: android:label="@string/search_label"
4: android:hint="@string/search_hint"
5: android:searchSettingsDescription="@string/search_settings_description"
6: android:searchSuggestAuthority="searchprovider"
7: android:searchSuggestIntentAction="android.intent.action.SEARCH"
8: android:searchSuggestThreshold="1"
9: android:includeInGlobalSearch="true"
10: android:searchSuggestSelection=" ?"
11: >
12: </searchable>
参数说明:
android:searchSuggestAuthorith
此属性的值就是SearchSuggestAuthorith中的AUTHORITH了。
android:searchSuggestIntentAction
此属性定义了当我们选中搜索提示的内容时发生的目的动作。
android:searchSuggestThreshold
此属性定义了至少输入几个字符时才会弹出提示
android:includeInGlobalSearch
是否将内容加入android的全局搜索。true,加入。
android:searchSuggestSelection
定义搜索时参数的占位符
PS:配置参数不止这些,可以自己看看android的参考手册。
3.配置AndroidManifest.xml
1: <provider android:name=".SearchSuggestionsProvider" android:authorities="searchprovider" />
注意authorities的属性值哦。o(∩_∩)o