Android : Showing keyboard moves my components up, i want to hide them instead

AndroidAndroid Layout

Android Problem Overview


I have added a LinearLayOut having some buttons My screen is RelativeLayOut it self

Here is the code for that linear layout manager

<LinearLayout
    android:orientation="horizontal"
    android:gravity="bottom"
    android:layout_alignParentBottom="true"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:id="@+id/Footer"
    android:layout_marginBottom="5dp">

Here is the problem:

There is an EditText component on the top and it pops a soft keyboard on the screen , and brings my Footer manager on top of the keyboard and eventually SHATTERS my whole UI.

What is the exact solution?

P.S. I have removed android:gravity="bottom" and android:layout_alignParentBottom="true" one by one but with hard luck i did not get desired result.

Thanks

Android Solutions


Solution 1 - Android

Add android:windowSoftInputMode="adjustPan" to manifest - to the corresponding activity:

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

Solution 2 - Android

You probably want

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

That will prevent any layout changes when the soft keyboard is shown.

There is probably some confusion over this since it's currently missing from the documentation at http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionPrashamView Question on Stackoverflow
Solution 1 - AndroidAsahiView Answer on Stackoverflow
Solution 2 - AndroidaaronvargasView Answer on Stackoverflow