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.google.com/file/d/0B3NUAgD0tB0YOS16azFCWXdSVVE/edit
But when I tap on the last EditText to enter some data, the dialog still shows, when I type the first character, the dialog scrolls down. The dialog stays behind the keyboard, with some parts totally obscured.
Could anyone tell me how to show the whole dialog above the soft keyboard? This is how I'd like it to look:
https://docs.google.com/file/d/0B3NUAgD0tB0YOFVQYUF0U0JvOEk/edit
Thanks
Clark
Have you tried ths one?
Worked for me:
http://developer.android.com/reference/android/view/Window.html#setSoftInputMode(int).
alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
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 );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With