私はSOに関する多くの回答を調査し、ダイアログがポップアップしたときにキーボードを表示する次のコードを考え出しました。
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Title");
final EditText input = new EditText(this);
input.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean focused) {
alertDialog
.getWindow()
.setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
});
input.setFocusable(true);
input.requestFocus();
alertDialog.setView(input);
alertDialog.show();
ダイアログが表示されますが、キーボードがポップアップしません。それが違いを生むのであれば、これはすべてonTouch(...)メソッド内にあります。
私のアプリはランドスケープモードのみです。ポートレートモードでは、表示されていることがわかります。どうしてこれなの?
どんな助けでも大歓迎です。