Prasham
Prasham

Reputation: 6686

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

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

Upvotes: 65

Views: 50276

Answers (2)

aaronvargas
aaronvargas

Reputation: 14192

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

Upvotes: 19

Asahi
Asahi

Reputation: 13486

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

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

Upvotes: 170

Related Questions