Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Adjust screen when keyboard pops up?

I want to be able to adjust my UI screen on Android when the soft keyboard pops up.

So at the minute I have something similiar to the first picture below where I have and EditText at the bottom of the screen and when a user taps the EditText I want the same as what happens in the second picture.

That is that the EditText gets moved up and appears to "sit" on top of the soft keyboard, when the soft keyboard dissapears it should then return to its prior state.

Can anyone let me know the best way to approach and implement this?

alt text http://img40.imageshack.us/img40/2300/keyboarddown.png


alt text http://img46.imageshack.us/img46/9339/keyboardup.png

like image 317
Donal Rafferty Avatar asked Apr 01 '10 09:04

Donal Rafferty


People also ask

How do I stop my keyboard from pushing up my screen?

How do I stop my keyboard from pushing up my screen? Add android:windowSoftInputMode="stateHidden|adjustPan" in required activity of your manifest file . This makes keyboard appear overlaying content, without making layout to recalculate it's height.

How do you move the view up when keyboard appears on Android flutter?

Scrolling up scrollview when keyboard is shown We can add bottom padding into the scrollview using its contentInset property, so the content inside will be moved up when a keyboard is shown. You can think of contentInset as an additional padding extending from the content area edges.

What is soft input mode?

The Android system shows an on-screen keyboard—known as a soft input method—when a text field in your UI receives focus.


2 Answers

You need to add android:windowSoftInputMode="adjustResize" to your tag in the AndroidManifest.xml file.

like image 51
rascalking Avatar answered Sep 22 '22 05:09

rascalking


take a look at android:windowSoftInputMode

like image 33
Samuh Avatar answered Sep 20 '22 05:09

Samuh