Android: landscape search tool

The search tool in the StatusBar reverses if in landscape orientation.

This only happens when the search bar expands.

See screenshots. 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" /> 

And the menu

 <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
source share
1 answer

Finally fixed it. Put android:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen" in your SEARCHABLE xml if you are using the widget SearchView .

 <?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" /> 
0
source

All Articles