<?XML version= "1.0" encoding= "Utf-8"?> <searchablexmlns:android= "Http://schemas.android.com/apk/res/android"Android:label= "string resource"Android:hint= "string resource"Android:searchmode=["Queryrewritefromdata"| "Queryrewritefromtext"] android:searchbuttontext= "string resource"Android:inputtype= "InputType"android:searchsuggestauthority= "string"Android:searchsuggestpath= "string"android:searchsuggestselection= "string"android:searchsuggestintentaction= "string"Android:searchsuggestintentdata= "string"Android:searchsuggestthreshold= "int"Android:includeinglobalsearch=["true"| "false"] android:searchsettingsdescription= "string resource"Android:queryafterzeroresults=["true"| "false"] Android:voicesearchmode=["Showvoicesearchbutton"| "Launchwebsearch" | "Launchrecognizer"] Android:voicelanguagemodel=["Free-form"| "Web_search"] android:voiceprompttext= "string resource"Android:voicelanguage= "string"Android:voicemaxresults= "int" > <ActionkeyAndroid:keycode= "KeyCode"android:queryactionmsg= "string"android:suggestactionmsg= "string"Android:suggestactionmsgcolumn= "string" > </searchable>
First, the general properties
1. Label= "String resource"
【必选】它应该和你的程序的名字一样。只有android:includeInGlobalSearch为"true"时,它才多用户可见。它就是在search settings的searchable列表中所用的名字。 2. hint建议包含该属性。它是用户在输入框键入字符之前,在输入框显示的字符。为个和别的应用程序一致,它应该为搜索xx,比如"Search songs and artists" or "Search YouTube"
3. Searchmode
Search mode. It indicates how the search keyword in the input box is rewritten when the user chooses a suggestion (hint suggestion). If this property is set, the search keyword overrides in the input box are not made.
如果设置该属性,则有两种模式可以选: Queryrewritefromtext: rewritten with the contents of the Suggest_column_text_1 column of the suggestion cursor. queryRewriteFromData: This suggestion cursor's suggest_column_intent_data column will be used to overwrite query text. However, the value of Suggest_column_intent_data must be a URI that is visible to the user (such as HTTP) or other format, and cannot use an internal URI. 4. searchButtonText搜索按钮的文本。默认的是搜索按钮显示的是个搜索图标。如果你的搜索行为是普遍的搜索行为,请不要改变它,即不要设置该属性。5. inputType输入的类型。对于大多数搜索应该,都是输入文本来进行搜索,所以一般你不需要设置该属性。
For more properties, refer to:
http://blog.csdn.net/hudashi/article/details/7055959
http://blog.csdn.net/imdxt1986/article/details/7311968
Read more about the search box in Android (iv)--searchable configuration file