adjustResize属性无法在Android

时间:2015-08-18 23:14:53

标签: android webview android-webview window-soft-input-mode

我有一个在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本身和软件键盘有关。有谁知道如何解决这个问题?

0 个答案:

没有答案
相关问题