Galaxy Nexus的编辑文字在横向上不是全屏

时间:2012-05-07 19:38:22

标签: android android-4.0-ice-cream-sandwich android-softkeyboard

在我的应用程序中,我有一个搜索按钮,单击该按钮将使EditText小部件可见,将焦点放在其中,并显示键盘。当我这样做时,我称之为代码:

queryTextView.requestFocus();
    InputMethodManager imm = Utilities.getInputMethodManagerFromContext(getContext());
    imm.showSoftInput(queryTextView, InputMethodManager.SHOW_FORCED);

第一次显示我希望它在景观中:

Working example

输入文字并点击搜索后,我会隐藏我的EditText并强制键盘关闭。我使用此代码执行此操作:

InputMethodManager imm = Utilities.getInputMethodManagerFromContext(getContext());      
    imm.hideSoftInputFromWindow(getWindowToken(), 0);

如果我再次按下我的按钮以使EdidText可见并再次显示键盘,我的屏幕看起来像这样(仅当使用股票Galaxy Nexus键盘时):

Broken landscape

使用其他键盘,例如SwiftKey,我没有这种行为。我可以找什么样的东西来找出为什么这个软键盘没有完全充满屏幕?

2 个答案:

答案 0 :(得分:1)

编辑:第二个想法,从你的截图看起来键盘正试图占据全屏,所以onEvaluateFullscreenMode应该返回true ...也许问题出在onCreateExtractTextView

不是你想要的,但如果所有其他方法都失败了,也许你可以抓住AOSP键盘源,浏览它并弄清楚是否/为什么onEvaluateFullscreenMode正在返回,或者它可能没有被调用一点都不。

答案 1 :(得分:0)

使用android:imeOptions =“flagNoFullscreen”来实现该功能。