2017-09-17 9 views
0

ステータスバーの検索ツールは、横向きになると完全に変更されます。Android:検索ツール(横向き)

検索バーが展開されている場合にのみ発生します。

スクリーンショットをご覧ください。 Portrait Mode

Landscape Mode

EDIT

CODE:

@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    getMenuInflater().inflate(R.menu.action_menu, menu); 

    SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); 
    SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); 
    int options = searchView.getImeOptions(); 
    searchView.setImeOptions(options| EditorInfo.IME_FLAG_NO_EXTRACT_UI); 

    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); 
    searchView.setIconified(true); 
    searchView.clearFocus(); 

    return true; 
} 

XML:

<?xml version="1.0" encoding="utf-8"?> 
<searchable xmlns:android="http://schemas.android.com/apk/res/android" 
    android:label="@string/app_name" 
    android:searchSuggestAuthority="Search in a Collection/Book or Favorites" 
    /> 

とメニュー

<item 
    android:id="@+id/search" 
    app:actionViewClass="android.support.v7.widget.SearchView" 
    app:showAsAction="ifRoom" 
    android:title="Search in a Collection/Book or Favorites"/> 
+0

は、あなたはこれを試してみました:https://stackoverflow.com/questions/6075719/android-search-dialog-in-landscape-mode – Darush

+0

また、この:https://stackoverflow.com/questions/31456029/どこにでもある - 回避する - 全画面 - 検索ビュー - キーボード - オン - ランドスケープ – Darush

+0

それらのどれも私のために働いていないようだ。 –

答えて

0

最後に修正しました。 widgetSearchViewを使用している場合はandroid:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen"をSEARCHABLE xmlに入れてください。

<?xml version="1.0" encoding="utf-8"?> 
<searchable xmlns:android="http://schemas.android.com/apk/res/android" 
    android:label="@string/app_name" 
    android:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen" 
/> 
関連する問題