簡體   English   中英

在Android上橫向顯示軟鍵盤

[英]showing softkeyboard in android on landscape orientation

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"時,它將停止工作。 它出什么問題了?

您需要強行顯示它。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM