开发者

Android search dialog in landscape mode

I'm using searchable.xml to search the email. When in landscape mode, the ui background is showing as a white screen,开发者_如何学Go please give me solution for the issue.

Thanks, Sneha


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

android:imeOptions="flagNoExtractUi" 


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);


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜