Android: how to avoid layout when you press the keyboard

I have a layout as shown below

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:weightSum="1"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content"> <Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="Button" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="Button" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="Button" android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> <Button android:text="Button" android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> </LinearLayout> <ImageButton android:id="@+id/imageButton1" android:src="@android:drawable/stat_notify_sync_noanim" android:layout_height="fill_parent" android:layout_weight="1" android:layout_width="fill_parent"></ImageButton> <EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="match_parent"> <requestFocus></requestFocus> </EditText> </LinearLayout> 

when the soft keyboard is called by clicking on the editable text, the whole layou object is popped. Can I keep the buttons on the title corrected and skip the image? Because the buttons will act like a navigation bar, so it should be there even when the layout is pushed up.

Front enter image description here

After enter image description here

+4
source share
3 answers

Read the article here: http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html
You must add to the android manifest: windowSoftInputMode = "adjustResize" in your activity tag.

Editorial: Correct flag: android: windowSoftInputMode = "adjustResize"

+10
source

Of all the properties for android: windowSoftInputMode in the manifest only works

Android: windowSoftInputMode = "adjustNothing"

+8
source

In my AndroidManifest file, I added the following code to the action:

 android:windowSoftInputMode="adjustPan" 

History

Actually, I tried AdjustResize and AdjustNothing, but it did not work on my end, so I tried other ways. I found this answer helpful and hope it solves your problem too! :)

+4
source

All Articles