editext获取焦点并自动弹出输入键盘,代码如下:
EditTexteditText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.requestFocus();
InputMethodManagerinputManager=(InputMethodManager)editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(editText,0);
如果是已经入某个界面就要立刻弹出输入键盘,可能会由于界面未加载完成而无法弹出,需要适当延迟,比如延迟500毫秒:
Timertimer=newTimer();
timer.schedule(newTimerTask()
{
publicvoidrun()
{
InputMethodManagerinputManager=(InputMethodManager)editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(editText,0);
}
},500);
如果觉得《android软键盘自动弹出 android安卓editText自动弹出软键盘(输入键盘)》对你有帮助,请点赞、收藏,并留下你的观点哦!