How to resize Relativelayout while keyboard is active

Asked

Viewed 213 times

0

Good night! I’m a beginner on android, so I’m sorry if it’s a stupid question. I did not find solution to my problem in this forum, so I decided to create this post.
I have a very simple application, as in the image below:
Layout sem teclado

When the user touches Edittext and the keyboard appears, my entire application is pushed up. I don’t want that to happen: Instead, I’d like Relativelayout to resize to fit on the screen, like in the drawing: Layout com teclado

What is the best way to do this? Thank you!

  • 1

    You can try using the android tag:windowSoftInputMode="adjustResize" in the manifest. It can be set via Activity also getWindow(). setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

  • @franM Worked perfectly! Thank you very much.

1 answer

1


FranM answered my question in comment:

You can use this tag in the manifest:

android:windowSoftInputMode="adjustResize"

Or can be set via Activity as well

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.