Android search dialog in landscape mode

安稳与你 提交于 2019-12-24 10:02:24

问题


I'm using searchable.xml to search the email. When in landscape mode, the ui background is showing as a white screen, please give me solution for the issue.

Thanks, Sneha


回答1:


I had the same problem as 'sneha' and it gets fixed by setting "flagNoExtractUi" ime option for the SearchView. i.e.

android:imeOptions="flagNoExtractUi" 



回答2:


With SearchView, if you don't want to show full-screen keyboard while in Landscape mode (rather show normal keyboard), IME_FLAG_NO_EXTRACT_UI and IME_FLAG_NO_FULLSCREEN flags need to add in Ime options. You can do it within your Java code in onCreateOptionsMenu(..) method,

searchView = (SearchView) .... // get or find your searchView here
searchView.setImeOptions(searchView.getImeOptions() | EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN);



回答3:


create a folder res/layout-land and place the searchable.xml inside it with the layout that you want. While changing the orientation from Portrait to landscape the corresponding XML will be considered for the UI.




回答4:


Maybe you need to provide search suggest options in searchable.xml. For example:

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/search_label"
    android:hint="@string/search_hint"
    android:icon="@android:drawable/ic_menu_search" 

    android:searchSuggestAuthority="shelves"
    android:searchSuggestIntentAction="android.intent.action.VIEW"
    android:searchSuggestIntentData="content://shelves/books" />

Simply, android:searchSuggestAuthority="" is enough if you don't need searchSuggest. Hope it helps.



来源:https://stackoverflow.com/questions/6075719/android-search-dialog-in-landscape-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!