Fred
Fred

Reputation: 17085

Soft keyboard not pushing webview content up neither resizing

Put simply, after loading the content in a webview and tapping on a text field, my app refuses to resize or pan.

Here's my setup

I have a single Activity with multiple fragments. Here's the layout with the container for the fragment.

 <android.support.v4.widget.DrawerLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"      
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent" 
    android:layout_height="match_parent">
    <!-- MAIN CONTENT -->
    <FrameLayout 
       android:id="@+id/container"
       android:layout_width="match_parent"
       android:layout_height="match_parent"   
       android:background="@android:color/white" />

    <RelativeLayout
       android:layout_width="240dp"
       android:layout_height="match_parent"
       android:layout_gravity="start">

       <!-- ... -->
    </RelativeLayout>
</android.support.v4.widget.DrawerLayout>

Here's the webview fragment's layout.

<RelativeLayout   
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include
        android:id="@+id/tbOnlinePayment"
        layout="@layout/toolbar" />

    <WebView
        android:layout_below="@+id/tbOnlinePayment"
        android:id="@+id/paymentWebView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <ProgressBar
        android:id="@android:id/progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"/>

</RelativeLayout>

My app's theme extends Theme.AppCompat.Light.DarkActionBar

what I've tried:

What I want:

I don't really care if the webview is resized or pushed up. What I want is the keyboard not to hide the input fields.

Upvotes: 7

Views: 3873

Answers (1)

Alp Altunel
Alp Altunel

Reputation: 3443

I tried:

    <activity
        android:name="com.myapp.MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">

adjustResize solved the problem.

Upvotes: 2

Related Questions