4

I know there is heaps on here related to the virtual keyboard in Android, but I just cant seem to figure out how to achieve a solution to my problem.

For those that are not familiar with AdjustPan and AdjustResize you can check out what they are/do here - Difference between adjustResize and adjustPan in android?

What I am trying to achieve is the AdjustPan result in which my webview is not resized, but scrolls to the input box instead as I have submit/cancel buttons that are position:absolute to the bottom of the screen. When I use the AdjustPan setting, the keyboard opens up but covers my input and doesn't scroll the webview to the input.

On the other hand when I use the AdjustResize option, the position:absolute buttons from the footer cover the last few inputs as there is quite a lot of content to fit in half the screen size.

Currently my Activity looks like this

<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="adjustResize">

I am trying to avoid the Javascript listener solutions as they seem a bit hackery and from my experience usually don't provide a seamless look and feel.

Community
  • 1
  • 1
SM3RKY
  • 1,548
  • 1
  • 14
  • 27

1 Answers1

0
  1. OPTION 1

Add a blank layout with height approximately equal to the height of keypad. Move the webview and the blank layout into a ScrollView and disable the webviews scroll.

  1. OPTION 2

Append a few line breaks to the web content that is loaded in the webview.

pvn
  • 2,016
  • 19
  • 33