20

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

Bilbonic
  • 225
  • 1
  • 2
  • 7

3 Answers3

47

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

Community
  • 1
  • 1
kenodoggy
  • 1,359
  • 14
  • 8
  • 1
    Sorry for the delayed response. This did the trick though. Thank you very much. – Bilbonic Oct 24 '13 at 20:16
  • 8
    No, didn't work. Adding this automatically shifts the bottom button upwards....I don't want this. I just want to make it visible when I scroll. Not as soon as keyboard is opened. – Narendra Singh Aug 19 '15 at 08:11
  • @AllTimeKing-Narendra read up on the difference between adjustResize and adjustPan. If for some reason you actually do want the button to be obscured by the keyboard when the keyboard is up then don't do either of these things. To me that sounds like a poor user experience, but if this is what you need you'll need to ensure your view is obviously scrollable. Try android:windowSoftInputMode="adjustNothing" or do it in java code. However, this should be a new question as this is a different problem. – kenodoggy Jul 06 '16 at 16:05
  • it doesn't work if your activity use **FULL_SCREEN** style. or you have to **REMOVE** something like this: **getWindow() .getDecorView() .setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);** in you code. – Phong Nguyen May 06 '17 at 04:52
  • I applied this attribute in my ScrollView instead of Activity and it wokred fine. Thanks! – Machado Jul 08 '20 at 14:45
0

Add android:windowSoftInputMode="adjustResize" to your tag in AndroidManifest.xml file. This will cause the screen to be resized to the left over space after the soft keyboard is shown. So, you will be able to scroll easily.

Rajesh Hegde
  • 2,702
  • 1
  • 18
  • 23
0

Had similar problem with NestedScrollView. Changing to ScrollView helped.