您的位置:首页 > 产品设计 > UI/UE

Android中全局搜索(QuickSearchBox)(三)

2013-10-24 17:01 344 查看
1. 标题:

 

支持全局搜索的应用程序的配置文件介绍

 

2. 引言:

 

在全局搜索应用程序(QuickSearchBox)进行搜索或打开相关应用程序显示搜索結果时,从搜索源(支持全局搜索的应用程序)中获取配置信息,根据配置信息可以组拼成URI 请求搜索源的ContentProvider 或构建Intent 打开搜索应用显示搜索結果, 等.

 

3. 配置介绍:

 

在应用程序的res目录中新建xml目录,在xml目录中新建searchable.xml文件,默认配置为:

<?xml version = "1.0" encoding = "utf-8"?>

<searchable 

      xmlns:android = "http://schemas.android.com/apk/res/android" 

      android:label = "@string/app_label"

      >

</searchable>

 

属性:

 

(1)android:label (String字符串,必须存在,一般为应用程序中Activity或Application的名称,在配置中包含

 

          android:includeInGlobalSearch属性时起作用,在设置搜索范围时显示应用名称)。

 

(2)android:hint (String字符串,搜索输入框中的提示信息,格式为:"Search ***")。

 

(3)android:searchMode (关键词,当搜索結果列表中的某一项获得焦点时,使用这一项的某些值进行重新搜索,信息包括二种,第一,

 

          "queryRewriteFromData",使用搜索結果Cursor中的"SUGGEST_COLUMN_INTENT_DATA"列值,第二,"queryRewriteFromText",

 

          使用搜索結果Cursor中的"SUGGEST_COLUMN_TEXT_1"列值)。

 

(4) android:searchButtonText (String字符串,搜索按钮提示内容,默认是图片)。

 

(5)android:inputType (关键词,搜索框输入法类型)。

(6)android:imeOptions (关键词,搜索框输入法的设置选项)。

(7)android:searchSuggestAuthority (String字符串,提供搜索功能的ContentProvider的Authority)。

(8)android:searchSuggestPath (String字符串,请求搜索ContentProvider的URI的建议路径)。

(9)android:searchSuggestSelection (String字符串,Where条件,例:"uri like ?")。

(10)android:searchSuggestIntentAction (String字符串,单击搜索結果列表中的某一项时,发出Intent对象中的Action)。

(11)android:searchSuggestIntentData (String字符串,单击搜索結果列表中的某一项时,发出Intent对象中的Data)。

(12)android:searchSuggestThreshold (int值,输入多少个字符后开始搜索)。

(13)android:includeInGlobalSearch (boolean值,是否支持全局搜索QuickSearchBox))。

(14)android:searchSettingsDescription (String字符串,搜索设置的描述信息)。

(15)android:queryAfterZeroResults (boolean值,"true","false"如果搜索結果为零,下次搜索时则不会使用搜索源搜索,重启

 

            SearchDialog后又可搜索)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android 全局搜索