显示Android软键盘

显示Android软键盘,android,android-edittext,virtual-keyboard,Android,Android Edittext,Virtual Keyboard,我正在尝试显示软键盘。我找到了很多答案,但没有一个能解决我的问题。 InputMethodManager imm=(InputMethodManager)activity.getSystemService(Context.INPUT\u方法\u服务); imm.showSoftInput(错误[0],InputMethodManager.SHOW\u隐式); 错误[0]。requestFocus() 试试这个。活动开始时,将弹出软键盘:- this.getWindow().setSoft

我正在尝试显示软键盘。我找到了很多答案,但没有一个能解决我的问题。 InputMethodManager imm=(InputMethodManager)activity.getSystemService(Context.INPUT\u方法\u服务); imm.showSoftInput(错误[0],InputMethodManager.SHOW\u隐式);
错误[0]。requestFocus()

试试这个。活动开始时,将弹出软键盘:-

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
或者将其添加到要在其启动时显示软键盘的活动中:-

android:windowSoftInputMode="stateVisible"
或者,如果您希望在编辑文本时弹出软键盘:-

    InputMethodManager imm = (InputMethodManager)getSystemService(
              Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(myEditText.getWindowToken(), 0);