androidkeyboardscrollview

Android ScrollView doesn't scroll when the keyboard is up


I have a view that does not fill the screen, but when the keyboard comes up, You can NOT scroll down to the few fields that are now covered. I have tried adding adjustSize, adjustPan in the manifest and in the class. The xml is similar to following entry:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/s"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    >

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>



</TableLayout>
</ScrollView>

I need to be able to scroll through the editTexts and TextViews when the keyboard appears


Solution

  • The link that Flipbed provided is the answer to your solution. You don't need to implement your workaround if you simply add "adjustResize" to your activity in the manifest. The problem you were having before is that you were using adjustPan. Where adjustPan does not resize the window, it pans the view so that whatever has focus is never obscured by the soft keyboard. If you check out Google's documentation (see link below) it will make sense.

    Example:

    <activity android:name="YourActivity" 
              android:windowSoftInputMode="adjustResize" />
    

    http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft