How to not distort the layout when opening the keyboard?

Asked

Viewed 317 times

5

I have a linear layout with a form. Whenever the keyboard is opened it distorts my layout leaving my Buttons in half, is there any way to keep my layout intact when the keyboard is opened?? Some command to lock my layout behind the keyboard??

3 answers

4


Fala Edu,

Try to place this line inside your onCreate method:

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

This will cause the layout to adjust without distorting, when you open the keyboard.

Hugs.

  • Thank you is what I needed.

1

The option you are looking for is to adjustPan. In Manifest, put in the entry corresponding to your Activity:

<activity
    ...
    android:windowSoftInputMode="adjustPan"
    ...
>
</activity>

1

I use this to adjust the layout with the keyboard open, maybe I can help you!

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.