在Android上横向显示软键盘

时间:2015-04-09 17:34:37

标签: android keyboard show-hide

EditText textView = (EditText ) findViewById(R.id.editText1);
textView.requestFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(textView, InputMethodManager.SHOW_IMPLICIT);

我使用此代码自动打开软键盘。 它在正常情况下工作正常,但当我将其更改为横向时android:screenOrientation="landscape" 在清单中,它停止工作。 它有什么问题?

1 个答案:

答案 0 :(得分:0)

你需要有力地展示它。

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY);
imm.showSoftInput(textView, InputMethodManager.SHOW_FORCED);