Akirayjin
Akirayjin

Reputation: 697

Dialog goes up when softkeyboard is shown

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.

Upvotes: 5

Views: 9463

Answers (2)

cbw
cbw

Reputation: 266

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

Upvotes: 11

Dekra
Dekra

Reputation: 572

Try to do this:

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

Upvotes: 10

Related Questions