首页 > 解决方案 > Android WebView 不在 Chrome 78 中呈现 iframe 内容

问题描述

我们有一个带有 iframe 的 html 内容,加载在 webview 中。使用 chrome 版本 78 时,内容将首先呈现第一段,然后在一定高度显示空白,有时会扭曲文本直到底部。

要重现,请将 webview 放在滚动视图中并加载包含 iframe 标签的内容,webview 不会加载所有内容。

<androidx.core.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:scrollbars="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
            <RelativeLayout
                android:id="@+id/layoutHeader"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <ImageView
                    android:layout_width="match_parent"
                    android:layout_height="120dp"
                    android:src="@drawable/img_logo" />

            </RelativeLayout>

            <WebView
                android:id="@+id/webView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:scrollbars="none" />
        </LinearLayout>

    </androidx.core.widget.NestedScrollView>

一些扭曲的结果如下所示: 网页浏览错误

标签: androidwebviewchromiumnestedscrollview

解决方案


推荐阅读