搜索编辑文本像谷歌播放 [英] Search Edit Text like Google Play
本文介绍了搜索编辑文本像谷歌播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何实施搜索编辑文字像谷歌的地方,语音搜索和建议列表应显示如下完整的编辑文本布局,返回播放和取消按钮上右击。
How to implement Search Edit text like Google play with Back and Cancel button on Right at place of Voice search and suggestions list should display below the complete edit text layout.
推荐答案
这是搜索查看有一些定制
检查文档 http://developer.android.com/guide/topics/搜索/搜索dialog.html
This is SearchView with some customization check the docs http://developer.android.com/guide/topics/search/search-dialog.html
Actvity声明如下
Actvity declared like this
<activity android:name=".SearchableActivity"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
和搜索查看XML
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable>
此外,你需要重写onSearchRequested
Also you would need to override the onSearchRequested
@Override
public boolean onSearchRequested() {
Bundle appData = new Bundle();
appData.putBoolean(SearchableActivity.JARGON, true);
startSearch(null, false, appData, false);
return true;
}
这篇关于搜索编辑文本像谷歌播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文