lixplor / android-Q-A

🐞 android related questions and answers
0 stars 0 forks source link

自定义Dialog中的EditText点击无法弹出键盘 #63

Closed lixplor closed 7 years ago

lixplor commented 7 years ago

自定义Dialog中的EditText点击无法弹出键盘

lixplor commented 7 years ago

原因: dialog默认不会获取焦点 解决: 自定义dialog的flag

@Override
public void show() {
   super.show();
   // 添加这行代码即可
   this.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
   this.setContentView(mView);
}