WebView无法将所有内容加载到ScrollView

时间:2019-05-10 13:19:41

标签: android webview scrollview

我需要在WebView中显示一些html内容,其父级是ScrollView。内容基本上是一些带有字体,文本大小和字体大小自定义的文本。为避免滚动问题,我将WebView的高度设置为wrap_content,因此它没有任何滚动。

当内容太大时,它会被切除,因此WebView只显示其中的一部分,但是如果在内容加载之前滚动到视图的末尾,它将完全加载。

我尝试使用由WebView插入的TextView,但它忽略了自定义项。

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        ...

        <android.support.v7.widget.CardView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            ...>

            <android.support.constraint.ConstraintLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                ...

                <WebView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    ... />
            </android.support.constraint.ConstraintLayout>
        </android.support.v7.widget.CardView>
    </android.support.constraint.ConstraintLayout>
</ScrollView>

0 个答案:

没有答案
相关问题