- EditText 获取焦点后 直接弹出软键盘 利用定时器完美解决
- 可以自由控制弹出的时间
passwordInputView = dialogView.findViewById(R.id.pay_password);
passwordInputView.setFocusable(true);
passwordInputView.setFocusableInTouchMode(true);
passwordInputView.requestFocus();
Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
InputMethodManager inputMethodManager =
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
}
}, 100);//这里的100是显示后多久弹出软键盘100=0.1/s