Android的检索字典结果不被显示在全局搜索 [英] android Searchable dictionary results are not being shown in global search
问题描述
我试图实现搜索的字典示例应用程序。
一切似乎除了当我尝试从拉全局搜索的结果是工作。
我曾试图按照已在文档中描述过的一切。
I have tried to implement the searchable dictionary sample app. Everything seems to be working except when I try to pull the results from global search. I have tried to follow everything that has been described in the docs too.
我searchable.xml
My searchable.xml
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/search_label"
android:hint="@string/search_hint"
android:searchSettingsDescription="@string/settings_description"
android:searchSuggestAuthority="sd2.com.achie.DictionaryProvider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestIntentData="content://sd2.com.achie.DictionaryProvider/dictionary"
android:searchSuggestSelection=" ?"
android:searchSuggestThreshold="1"
android:includeInGlobalSearch="true"
>
</searchable>
和有关部门,MIME类型
And the authorities, mime types
public static String AUTHORITY = "sd2.com.achie.DictionaryProvider";
public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/dictionary");
public static final String WORDS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE +"/vnd.sd2.com.achie";
public static final String DEFINITION_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE +"/vnd.sd2.com.achie";
我的清单是
<!-- Receives the search request. -->
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
<!-- No category needed, because the Intent will specify this class component-->
</intent-filter>
<!-- Points to searchable meta data. -->
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<!-- Displays the definition of a word. -->
<activity android:name=".WordActivity"
android:theme="@android:style/Theme.NoTitleBar" />
<!-- Provides search suggestions for words and their definitions. -->
<provider android:name=".DictionaryProvider"
android:authorities="sd2.com.achie.DictionaryProvider" />
<!-- Points to searchable activity so the whole app can invoke search. -->
<meta-data android:name="android.app.default_searchable"
android:value=".SearchableDictionary" />
可能是什么问题?
感谢您,
Achie
Thank you, Achie
推荐答案
一切都很好,但我没有明确的配置搜索设置显示在搜索结果中搜索字典。有一次,我补充说,一切正常。
everything was fine but I did not explicitly configure the search settings to show the searchable dictionary in search results. Once I added that, everything worked fine.
这篇关于Android的检索字典结果不被显示在全局搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!