1、EditText获得焦点
editText.setFocusable(true);
editText.setFocusableInTouchMode(true);
editText.requestFocus();
2、自动弹出软键盘
InputMethodManager imm = (InputMethodManager) editText.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
InputMethodManager.SHOW_FORCED 表示强制显示。
InputMethodManager.HIDE_NOT_ALWAYS 让输入法状态发生逆转,如果当前未显示则显示出来,如果已经显示则隐藏。