Obdam
Obdam

Reputation: 57

UI elements don't re-position on opening keyboard

I am currently busy learning how to use Firebase and I've built a very simple UI for my experiment. Unfortunately, when I test the app and I want to fill in the EditTexts with the keyboard, the keyboard is appearing over the UI elements. I can't figure out why this is happening. I've tried out ConstraintLayout and RelativeLayout, but the problem is on both layouts.

Before filling in EditText

enter image description here

During filling in EditText

enter image description here

Thanks in advance!

Upvotes: 0

Views: 51

Answers (2)

Pietro Scarampella
Pietro Scarampella

Reputation: 472

add

android:windowSoftInputMode="stateVisible|adjustResize"

to your activity in the manifest file.

Upvotes: 0

Fathima km
Fathima km

Reputation: 2699

add this line of cdoe which will scroll the layout to above the soft keyboard.

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

or, write your layout inside a scrollview

Upvotes: 1

Related Questions