In my app I have a webview which loads a webpage where the user should perform authentication. When the user selects some input field in the webpage, the webview should:
- focus on the field
- open the keyboard
- perform a scroll up in order for the user to keep seeing the field
However, the webview doesn't scroll up automatically, so the user doesn't see the field anymore. If the user tries manually to scroll, the webview does only a small scroll - not enough for the user to see everything he needs. The problem in not with the webpage itself, since when I browse to this webpage using android chrome, it does scroll up to keep the field in view and allows scrolling till the bottom of the page. I've read the following questions: WebView doesn't scroll when keyboard opened and adjustPan not preventing keyboard from covering EditText but the answers didn't fix the issue.
My current activity_web_viewlogin.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/portalWebViewWrapper"
android:orientation="vertical"
tools:context="com.hpe.sb.mobile.app.features.login.activities.WebViewLoginActivity">
<include
android:id="@+id/app_bar"
layout="@layout/app_bar" />
<ScrollView android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<WebView
android:id="@+id/portalWebView"
android:layout_below="@id/app_bar"
android:layout_width="match_parent"
android:layout_margin="@dimen/activity_vertical_margin"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</ScrollView>
</LinearLayout>
Tried also that the ScrollView contains the LinearLayout.
In my AndroidManifest.xml:
<activity
android:name=".features.login.activities.WebViewLoginActivity"
android:windowSoftInputMode="adjustResize"
android:label="" />
Tried also adjustPan instead of adjustResize.
Thanks in advance!