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:
android:windowSoftInputMode="adjustResize"
and android:windowSoftInputMode="adjustPan"
.android:windowSoftInputMode="adjustResize"
won't work, but I don't force this manually. I placed here the app's theme, because maybe someone knows this theme somehow forces fullscreen.<item name="android:windowFullscreen">false</item>
to the app's theme, but still no result.webview
in a scrollview
. webview
's height to wrap_content
.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.
The soft keyboard can be configured for each activity within the AndroidManifest. xml file using the android:windowSoftInputMode attribute to adjust both default visibility and also how the keyboard affects the UI when displayed.
I tried:
<activity
android:name="com.myapp.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
adjustResize solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With