ã½ãããã¼ãã¼ãã¯ä»¥ä¸ã®ã¡ã½ããã§è¡¨ç¤ºã§ããããã§ãã
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
ãããããã¤ã¢ãã°ã®å ´åã¯ãã¿ã¤ãã³ã°ãæªãã®ãæãéãã«è¡¨ç¤ºããã¾ããã
ä¸è¨ã¯ãActivity ã® getWindow() ã¡ã½ããã§ãããgetWindow() ã¡ã½ããã¯ãDialog ã¯ã©ã¹ã«ãããã¾ãããã¡ãã® getWindow() ã¡ã½ããã使ãã¨æãéãã«è¡¨ç¤ºããã¾ãã
以ä¸ã¯ãEditText ããã©ã¼ã«ã¹ãããã¿ã¤ãã³ã°ã§ã½ãããã¼ãã¼ãã表示ããä¾ã§ããéåæ㪠OnFocusChangeListener ããåç §ãããã®ã§ alertDialog 㯠final ã«ãªãã¾ãã
private void showDialog() { EditText editText = new EditText(this); final AlertDialog alertDialog = new AlertDialog.Builder(this) .setTitle("Dialog test") .setView(editText) .setPositiveButton("OK", null) .create(); editText.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); } } }); alertDialog.show(); }