Java 编辑文本焦点可以';t集

Java 编辑文本焦点可以';t集,java,android,Java,Android,当启动运行应用程序时,EditText的可视性设置为“gone”值。之后在java中的可视性设置值为visible。 我想在那个时候打开键盘,专注于编辑文本。我做了,但不工作 ` 尝试用以下方法更改它: editText.setFocusableInTouchMode(true); editText.requestFocus(); 还有这个: InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT

当启动运行应用程序时,EditText的可视性设置为“gone”值。之后在java中的可视性设置值为visible。 我想在那个时候打开键盘,专注于编辑文本。我做了,但不工作

`

尝试用以下方法更改它:

editText.setFocusableInTouchMode(true);
editText.requestFocus();
还有这个:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);