转自 stackoverflow
默认 alertbuilder 的焦点无法落到 edittextview。
用下面的方法,然后用dismislistener,去自动消失。
editText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
editText.post(new Runnable() {
@Override
public void run() {
InputMethodManager inputMethodManager= (InputMethodManager) YourActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
}
});
}
});
editText.requestFocus();
留意 manifest配置
android:windowSoftInputMode="adjustPan"
转载于:https://my.oschina.net/u/732114/blog/543001