0

こんにちは、みんな、

リストビューのアクティビティがあります。私は人々の入力によってリストビューを洗練する必要があります。

トピックhttp://developer.android.com/guide/topics/search/search-dialog.htmlに従って実装しようとしました。しかし問題は、検索ボタンを押した後、システムからデフォルトの検索バー(連絡先やブラウザ内の任意の単語を検索できる)しか取得できないことです。

だから私の質問は、ローカルで検索を実装する方法ですか?

前もって感謝します。


検索可能なアクティビティListActivity:

@Override
public boolean onSearchRequested(){
    Bundle bundle=new Bundle();
    bundle.putString("data", "data");
    startSearch(null, false, bundle, false);
    return true;
}

マニフェスト:

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="DiseaseListActivity"
android:hint="Search Diseases..." 
android:searchMode="showSearchLabelAsBadge"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:voiceLanguageModel="free_form"
android:voicePromptText="Please Speak"

/>

searchable.xml:

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="DiseaseListActivity"
android:hint="Search Diseases..." 
android:searchMode="showSearchLabelAsBadge"
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:voiceLanguageModel="free_form"
android:voicePromptText="Please Speak"/>
4

1 に答える 1

1

問題は解決しました。searchable.xmlでは静的文字列を使用できません。代わりに、次のような参照を使用する必要があります。

android:label="@string/app_name"

皆さん、ありがとうございました。

クリス

于 2011-01-18T23:21:51.020 に答える