How can I display a dialog above the keyboard

后端 未结 4 1611
野性不改
野性不改 2021-02-09 17:48

I\'m a newbie with android, I write an application which using the Dialog to display data when user select on one thing. This is how the dialog looks:

https://docs.googl

4条回答
  •  暖寄归人
    2021-02-09 18:27

    You may need to set dialog's width and height manually in order to make soft input mode work like this:

        WindowManager.LayoutParams params = window.getAttributes();
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        params.height = WindowManager.LayoutParams.MATCH_PARENT;
        params.gravity = Gravity.CENTER;
        window.setAttributes(params); 
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE ); 
    

提交回复
热议问题