Android window doesn't resize/pan when softinput opened from WebView

Viewed 16310

My problem is following.

  1. Application uses theme android:Theme.NoTitleBar.Fullscreen and there is only one Activity, all other views are Fragment
  2. I have WebView inside ViewPager Fragment which is inside ScrollView
  3. HTML content has input fields
  4. I click input field which is on bottom of WebView
  5. Soft input opens, but the Window is not resized/panned

I've tried setting android:windowSoftInputMode="adjustResize" or android:windowSoftInputMode="adjustPan" in my manifest for the Activity. Also tried setting one of those in java.

Normal EditText inside a ScrollView in my application does adjust pan properly so user can see where he/she is typing.

UPDATE:

If there is no working solution to get window adjust, is there a way to get WebView think it's content is like half screen height more bigger so user could at least scroll the input visible.

4 Answers

Try this android:isScrollContainer="false" in the ScrollView. According to the Android docx.

Set this if the view will serve as a scrolling container, meaning that it can be resized to shrink its overall window so that there will be space for an input method

Hope this will solve your problem

my code was also not able to resize when keyboard opens.

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

i removed (android:scrollbars="none") statement, and it worked ! So that means the app resizes itself only when the container is scrollable. so by default webview containers scrollable area internally.

Related