6

我有一个在 WebView 中显示 HTML 表单的活动。这是我的清单:

    <application
        android:allowBackup="true"
        android:label="@string/app_name" >
         <activity
            android:name=".SMFeedbackActivity"
            android:label="@string/app_name"
            android:screenOrientation="locked"
            android:windowSoftInputMode="adjustResize">
        <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
    </application>

和活动的布局:

<WebView xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/sm_feedback_webview"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />

当点击 WebView 中的文本输入元素时,会发生预期的 adjustResize 行为:活动调整大小以显示软件键盘,同时保持文本输入的焦点和可见性。但是,如果我滚动然后点击页面上的任何其他输入元素(例如单选按钮),WebView 将滚动回我之前编辑的文本输入。

当我在同一设备上的 Chrome 中编辑相同的表单时,不会发生此行为。我点击文本字段进行编辑,然后可以滚动页面上的其他位置并选择其他输入,而页面不会滚动回文本输入。

问题似乎出在 Android WebView 本身和软件键盘上。有谁知道如何解决这个问题?

4

0 回答 0