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

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后又可搜索)。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值