Dialog goes up when softkeyboard is shown

淺唱寂寞╮ 提交于 2020-01-02 04:11:15

问题


I have a class that extends Dialog. In that Dialog I have an EditText and a ListView. I can bring soft keyboard up when that dialog is shown. But my problem is can we make dialog not to go up when soft keyboard is shown? I tried to change softInputMode in layout params to adjust resize but it's not working. My Dialog uses x and y position, when soft keyboard is shown and dialog goes up, my dialog is not in the position I want.


回答1:


Try to do this:

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



回答2:


If you want it to resize and not just shift up use:

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

This will also let you scroll within the dialog



来源:https://stackoverflow.com/questions/8635783/dialog-goes-up-when-softkeyboard-is-shown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!