简体   繁体   中英

Adjusting pan on android dialog when edittext is behind the soft keyboard

So I have this piece of coding that I can't get to work: I have searched on the webs, and always found the same answer, but for some reason it just won't work. Any idea why? This is my code:

    final Dialog dialog = new Dialog(RegisterActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
    dialog.setContentView(R.layout.dialog_register_info_1);
    dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);

I have tried putting the dialog.getWindow().setSoftInputMode() behind the setContentView() too, but that didn't work either. The dialog only has a .xml file, so no activity.

Thanks in advance

I'm not sure if this is what you were looking for, but I wanted the dialog to appear above the keyboard and not behind it. What I did was this:

dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM