0

I have this code:

 <TableLayout
        android:layout_gravity="bottom"
        android:stretchColumns="0,1,2"
        android:id="@+id/table1"
        android:layout_centerHorizontal="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >
        <EditText
            android:layout_gravity="bottom"

            android:id="@+id/txtsearch"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="Search"

            />
        <TableRow

            android:id="@+id/tableRowFive"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
            <ImageView
                android:src="@drawable/arrow"
                android:adjustViewBounds="true"
                android:maxWidth="40dp"
                android:maxHeight="40dp"
                android:scaleType="fitCenter"
                />
            <TextView
                android:layout_gravity="center_horizontal|bottom"
                android:text="Click To View"
                android:textSize="26dp"
                />

            <ImageView
                android:src="@drawable/arrow2"
                android:adjustViewBounds="true"
                android:maxWidth="40dp"
                android:maxHeight="40dp"
                android:scaleType="fitCenter"
                />
        </TableRow>

</TableLayout>

Whenever I click on the EditText part of my TableLayout, The keyboard pops up just as usual, but the TableLayout goes on top with it. I want the TableLayout to stay on the bottom and not follow with the keyboard.

user8488959
  • 57
  • 1
  • 6

1 Answers1

0

In the manifest add this to the activity:

<application ... >
  <activity
    android:windowSoftInputMode="adjustPan" ... >
    ...
  </activity>
...
</application>

The logic behind is:

adjustResize = resize the page content

adjustPan = move page content without resizing page content

Uriel Frankel
  • 14,304
  • 8
  • 47
  • 69