Solutions Log

July 5th 2011

Android Soft Keyboard Resizes Web View

The default behaviour of Android is to resize the web view when the soft keyboard is displayed. This can cause undesirable behaviour when your PhoneGap application has elements positioned as fixed or absolute.

Normal Web View:

Soft Keyboard Resizes Web View:

Desired Result:


  • Go to your Android application directory
  • Open AndroidManifest.xml
  • Add android:windowSoftInputMode="adjustPan to <activity>

      <!-- Before -->
      <activity android:configChanges="orientation|keyboardHidden" android:label="@string/app_name" android:name="PhotoGap">
      <!-- After -->
      <activity android:configChanges="orientation|keyboardHidden" android:windowSoftInputMode="adjustPan" android:label="@string/app_name" android:name="PhotoGap">

The Android Developer Guides have good documentation for android:windowSoftInputMode