How to resize AlertDialog on the Keyboard display

Okay I have a AlertDialog box with approximately 10 controls (text and textview) on it. These controls are in a scrollview with alertdialog, plus I got 2 buttons positive and negative. The issue I have is when the soft keyboard pops up the two buttons are hidden behind the keyboard.

I was looking for something like redraw function on my inner View or the dialog box.

If any one has any idea please help. Below is the screen shot of what I am talking about.

How to resize AlertDialog on the Keyboard display

Android – Cannot resize AlertDialog

I am trying to resize an AlertDialog, which I have done before, but cannot remember how I did it. Below is the code Ive used, but it just inst working. Is anyone able to point out what I am doing wron

Hide keyboard in AlertDialog

I have an alertdialog with an editext. For this Edittext I make keyboard appear and I want that when user press ok or cancel to hide the keyboard. The strange problem is that when user choose ok, the

How to get keyboard size to resize UITextView and how to use UIKeyboardFrameEndUserInfoKey with Japanese keyboard?

How to get a keyboard size to resize UITextView and how to use UIKeyboardFrameEndUserInfoKey with Japanese keyboard? The following code to resize UITextView works good on a standard keyboard. But does

how to resize iphone keyboard?

I am developing a program in which I have to change the size of the keyboard according to the size of a UITextView, either increase or decrease. How can I do this?

How to resize iphone uitextfiled keyboard

Am working in iphone application. In my application i need to resize my uitextfield keyboard. When i click uitextfield the keyboard appear half of the screen. So i need to reduce height of the keyboar

AlertDialog with custom view doesn’t “resize”

I’m facing a problem with the AlertDialog and custom content / view. Simply said the AlertDialog doesn’t resize itself when the softkeyboard is opened. The following screenshots show best what my prob

How to display Toast from AlertDialog?

When the user clicks on the save button, an AlertDialog appears and asks the use to input text for the file name. If the user clicks the positive button (Ok) without specifying a name, I want to di

Display AlertDialog onLongClick

I have a listView and a onClickListener that onClick do som things and it works. Now I want to display an AlertDialog onLongClick but nothing happens. I’ve added android:longClickable=true to the Li

NumberPicker in AlertDialog always activates keyboard. How to disable this?

To all, I am trying to get a simple NumberPicker to work in a AlertDialog. The problem is that whenever I increase/decrease the value in the numberpicker, the keyboard activates. There are many posts

AlertDialog and soft keyboard

Hi guys I’m developing an android application.I’m using the alertDialog class.Where i have a custom listview and 2 buttons.In my custom listview i have an EditText Field.But when the dialog pops and i


maybe you don’t need to resize Dialog

add android:imeOptions=”actionNext” to EditText(all but last) (it will add “Next” button to the keyboard – go to next EditText)

and add android:imeOptions=”actionDone” to last EditText (“Done” button – hide keyboard)

now user should be able to click buttons

if you’re creating textboxes in code use EditText#setImeOptions function


Are you forced to have it as a popup? The popup looks so large, that you may just want to have it as a separate activity. In general, popups are used to provide a brief question or statement with a few options, not a full blown data entry form. Since you can’t see much behind the large popup, you’re not exposing any underlying controls anyways.

If your dialog was an activity using one of the Dialog themes you could effect this behavior by setting the adjustResize flag for the windowSoftInputMode parameter of the activity.

I’m using:


I think you can still use this flag with regular dialogs, but I’m not sure how to apply it. You may have to create your AlertDialog with a custom theme that inherits the right parent theme and also sets that flag, or you might have to use ContextThemeWrappers and stuff.

Or maybe you can just use Window#setSoftInputMode.


I’ve found a best way to handle this. Because this is a dialog, So the code “alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);” doesn’t work very well.

Besides this code, you must set a dialog style for this dialog. The style should like below:

<style name="DialogStyle" parent="@android:style/Theme.Black.NoTitleBar.Fullscreen">
    <item name="android:windowFullscreen">false</item>

NOTICE that the attribute “parent” is “Theme.Black.NoTitleBar.Fullscreen” like a activity’s style. and the attribute “android:windowFullScreen” should be false.

Now, the dialog will be resized when the soft keyboard toggled.

to show keyboard immediately and adjust size:

editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
    public void onFocusChange(View v, boolean hasFocus) {
        if (hasFocus) {
            dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);