1

This is my app when the soft keyboard is hidden enter image description here But when the keyboard is shown then the edittext box on the top is gone (it is push up). enter image description here and it looks like this.

My question is how can I keep both edit-boxes visible when the keyboard is shown? I want only the space in between the edit boxes to be reduced... but both boxes to be visible

my layout so far is like this

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" android:layout_width="fill_parent"
    android:id="@+id/relativeLayout1">
    <EditText android:id="@+id/editText1" android:layout_height="wrap_content"
        android:layout_alignParentTop="true" android:layout_width="fill_parent">
        <requestFocus></requestFocus>
    </EditText>
    <EditText android:id="@+id/editText2" android:layout_height="wrap_content"
        android:layout_alignParentBottom="true" android:layout_width="fill_parent"></EditText>
    <ImageView android:id="@+id/imageView1"
        android:layout_height="wrap_content" android:layout_below="@id/editText1"
        android:layout_above="@id/editText2" android:background="@drawable/icon"
        android:layout_width="fill_parent"></ImageView>
</RelativeLayout>
Lukap
  • 31,523
  • 64
  • 157
  • 244

1 Answers1

5

Go to your Android manifest and change the "Window soft input mode" from adjustPan, which moves the entire view, to adjustResize, which will resize the view for you.

Micah Hainline
  • 14,367
  • 9
  • 52
  • 85
  • 1
    In my manifest I put android:windowSoftInputMode="stateVisible|adjustResize" and it works, but can you give me a short explanation what is this ?, and can this be changed in code ? – Lukap Oct 27 '11 at 16:41
  • Android tries to handle the view for you, to ensure that the field you are typing in doesn't get hidden by the keyboard. There are a number of ways to do this. Panning just moves the entire view up until you can see the field. Resize resizes the entire view to take up the space not hidden by the keyboard, which is what you wanted. I know of no way to set it in code, but there probably is one somewhere. It's standard to set it in the xml though. – Micah Hainline Oct 27 '11 at 16:51