Show search suggestions when typing in landscape mode

I already get a search suggestion when I enter a search dialog in the search box. When entering in portrait mode, the result is displayed in the search dialog box. But when I switch to landscape mode, the searchdialog text box becomes fullscreen (I hope you know what I mean) and the search suggestions no longer see. I know, for example, from Google maps, which are also in landscape mode, search suggestions are displayed under the "large" text input field ... What code should I enter to get this "view" when entering in landscape mode?

Thank!

Thomas

+3
source share
1 answer

, , :

  • SUGGEST_COLUMN_QUERY .
  • android:searchMode="queryRewriteFromText" `` android: searchMode = "queryRewriteFromData" to your searchable.xml`

, , . , android:imeOptions="flagNoExtractUi" searchable.xml.

. , :

Hierarchy Viewer , SearchDialog, AutoCompleteTextView. buildDropDown() Filter.convertResultToString() ( convertSelectionToString()) , AutoCompleteTextView mAdapter.getItem(), InputMethodManager.displayCompletions() ( ).

SearchDialog SuggestionsAdapter. CursorAdapter, getFilter() CursorFilter, convertResultToString(), convertToString() . SuggestionsAdapter, , :

public CharSequence convertToString(Cursor cursor) {
    if (cursor == null) {
        return null;
    }

    String query = getColumnString(cursor, SearchManager.SUGGEST_COLUMN_QUERY);
    if (query != null) {
        return query;
    }

    if (mSearchable.shouldRewriteQueryFromData()) {
        String data = getColumnString(cursor, SearchManager.SUGGEST_COLUMN_INTENT_DATA);
        if (data != null) {
            return data;
        }
    }

    if (mSearchable.shouldRewriteQueryFromText()) {
        String text1 = getColumnString(cursor, SearchManager.SUGGEST_COLUMN_TEXT_1);
        if (text1 != null) {
            return text1;
        }
    }

    return null;
}

..., .

+5

All Articles