`
- 浏览:
11457780 次
-
Searchable之六(Voice Search和Search Suggestions)
十三,语言搜索(Voice Search)<wbr style="line-height:25px"><div style="line-height:25px">
<div style="line-height:23px; font-size:13px"><span style="color:#003366; line-height:23px">你可以通过在你的searchable配置中添加android:voiceSearchMode属性来实现search dialog或widget语言功能的添加。</span></div>
<div style="line-height:23px; font-size:13px"><span style="color:#003366; line-height:23px">这样就添加了一个用于启动voice prompt的语音搜索的按钮。一但用户完成了speaking, 这个transcribed search query将传送到你的searchable activity.</span></div>
<div style="line-height:23px; font-size:13px; font-weight:bold">示例11如下:</div>
<div style="line-height:23px; font-size:13px">
<div style="line-height:23px"><span style="color:#3366ff; line-height:23px"><?xml version="1.0" encoding="utf-8"?></span></div>
<div style="line-height:23px"><span style="color:#3366ff; line-height:23px"><searchable xmlns:android="http://schemas.android.com/apk/res/android"</span></div>
<div style="line-height:23px"><span style="color:#3366ff; line-height:23px"> android:label="@string/search_label"</span></div>
<div style="line-height:23px"><span style="color:#3366ff; line-height:23px"> android:hint="@string/search_hint"</span></div>
<div style="line-height:23px">
<span style="color:#3366ff; line-height:23px"> </span><span style="color:#ff6600; line-height:23px">android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"</span><span style="color:#3366ff; line-height:23px">></span>
</div>
<div style="line-height:23px"><span style="color:#3366ff; line-height:23px"></searchable></span></div>
</div>
<div style="line-height:23px; font-size:13px"><span style="color:#003366; line-height:23px">第一值"showVoiceSearchButton"用于开启voice search, 第二个值“launchRecognizer,”说明了voice search button应该启动一个recognizer来把transcribed text传递给你的searchable activity.</span></div>
<div style="line-height:23px; font-size:13px"><span style="color:#003366; line-height:23px">你还可以使用其他的一些属性来定义voice search的行为,比如语言和返回的最大结果数。</span></div>
<div style="line-height:23px; font-size:13px">
<span style="color:#003366; line-height:23px">关于</span><span style="line-height:23px; color:rgb(0,51,102)">voice search的</span><span style="color:#003366; line-height:23px">更多属性请参照</span><span style="line-height:22px; font-size:14px"><a rel="nofollow" href="http://developer.android.com/guide/topics/search/searchable-config.html" style="color:rgb(207,121,28); line-height:25px; text-decoration:none">Searchable
Configuration</a></span>
</div>
<div style="line-height:23px; font-size:13px">
<span style="line-height:23px">注意</span>:<span style="color:#000080; line-height:23px">请仔细考虑是否要在你的程序中使用voice search.所有通过voice search按钮的搜索都是直接传送给了你的searchable activity,用户根本没有机会预览transcribed query。需要充分测试语言识别(voice
recognition),以便它能识别用户在你的程序中提交的各种请求。</span>
</div>
<div style="line-height:23px; font-size:13px"><span style="color:#000080; line-height:23px"><br style="line-height:23px"></span></div>
<div style="line-height:25px"><span style="line-height:25px"><span style="font-size:16px; line-height:28px">十四、Search Suggestions</span></span></div>
<div style="line-height:25px">
<span style="font-size:13px; line-height:23px"></span>
<div style="line-height:20px; color:rgb(0,51,102)">search dialog和the search widget都可以在Android system系统的帮助下,在用户搜索的时候,提供建议搜索词。</div>
<div style="line-height:20px; color:rgb(0,51,102)">系统将管理suggestions列表并处理用户选中suggestion事件.</div>
<div style="line-height:20px; color:rgb(0,51,102)">一般你可以提供以下两种建议搜索词:</div>
<div style="line-height:20px">
<span style="line-height:23px">最近的搜索词</span><span style="color:#003366; line-height:23px">:</span>
</div>
<div style="line-height:20px">
<span style="color:#000080; line-height:23px">这些搜索词只是你以前的一些搜索关键词。更多的内容请参照</span><span style="line-height:23px"><a rel="nofollow" href="http://developer.android.com/guide/topics/search/adding-recent-query-suggestions.html" style="color:rgb(207,121,28); line-height:23px; text-decoration:none">Adding
Recent Query Suggestions</a>.</span>
</div>
<div style="line-height:20px"><span style="line-height:22px; font-size:14px"><span style="line-height:20px; font-size:13px"><span style="line-height:23px">个性化搜索词:</span></span></span></div>
<div style="line-height:23px">
<div style="line-height:23px"><span style="color:#000080; line-height:23px">这些search suggestions都来自于你自己的数据, 它帮助用户快速选择正确的拼写或他们要搜索的项.</span></div>
<div style="line-height:23px">
<span style="line-height:23px">图三</span><span style="color:#000080; line-height:23px">就是来自于dictionary程序一个个性化suggestions的界面图—用户可以选择一个suggestion来很快的得到它的定义。更多内容请参照</span><a rel="nofollow" href="http://developer.android.com/guide/topics/search/adding-custom-suggestions.html" style="color:rgb(207,121,28); line-height:23px; text-decoration:none">Adding
Custom Suggestions</a>
</div>
</div>
<div style="line-height:23px"><span style="line-height:23px">图三:</span></div>
<div style="line-height:23px"><span style="line-height:22px; font-size:14px"><img alt="Searchable之六(Voice Search和Search Suggestions) - hubingforever - 民主与科学" src="http://developer.android.com/images/search/search-suggest-custom.png" style="line-height:25px; border-top-width:0px; border-right-width:0px; border-bottom-width:0px; border-left-width:0px; border-style:initial; border-color:initial; max-width:100%; margin-top:0px; margin-right:10px; margin-bottom:0px; margin-left:0px"></span></div>
</div>
</div>
</wbr>
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
The Map Search Control is a simple to use application of the Google AJAX Search API that is designed to let you easily add a searchable map to your pages, sites, and blogs. The control on the right ...
一个简单的searchable配置实例,通过它来了解searchable搜索框的配置
Laravel开发-searchable Laravel查询生成器的扩展,提供简单但功能强大的全文搜索。
资源来自pypi官网。 资源全名:elasticsearch7-7.10.0a1.tar.gz
Laravel开发-laravel-searchable 查找Laravel的简单表格
Laravel开发-searchable 以 Trait 的形式为 Eloquent 模型增加搜索功能 以特征的形式为雄辩的模型增加搜索功能
搜索引擎排序怎么整合垂直搜索的资源 Federated search is an information retrieval technology that allows the simultaneous search of multiple searchable resources. A user makes a single query request ...
Generating Searchable Public-Key Ciphertexts With Hidden Structures for Fast Keyword Search
Laravel开发-eloquent-searchable 一个服务层,为您的雄辩模型的搜索提供支持。WIP当前仅支持ElasticSearch。
一个适合于win7的快速文件查找工具,第一次扫描可能需要30~40s,之后在文件没有更新的情况下可以在3s内快速找到。
非常的好用,可以对API进行Search