此处显示的第二张图像是设备处于横向模式时自动完成文本视图或编辑文本的结果。
如果设备处于肖像模式,它将在垂直列表中显示建议,对于横向模式,它将显示在水平列表中,并尝试用编辑文本和软键盘填充整个屏幕。
我也面临同样的问题,请查看Android开发者网站了解有关支持多屏幕的信息,它可能会对您有所帮助。
新建答案
要隐藏软键盘,当你按下完成按钮,你必须使用imeOptions为AutoCompleteTextView。对代码进行这些更改并尝试。
更改XML布局文件,如下
<AutoCompleteTextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:imeOptions="actionDone"
android:id="@+id/actv" />
在Java文件
actv = (AutoCompleteTextView)findViewById(R.id.actv);
actv.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
InputMethodManager imm = (InputMethodManager)v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
return true;
}
return false;
}
});
我希望它可以帮助你。
那么,在Nexus S本身,这在纵向模式下运行良好吗?并在景观模式中混乱吧? – Ghost
恰恰是这种情况! –
那么在这种情况下,请为景观设计单独的布局,并将它们放入res文件夹内的layout-land文件夹中。 – Ghost