Android - ScrollView内部的WebView在底部留下空白区域

Viv*_*vek 5 android android-webview android-scrollview

我想在滚动容器中添加多个WebView.为了做到这一点,我在LinearLayout中以编程方式添加它们.

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 android:id="@+id/scrollView"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">

 <LinearLayout
        android:id="@+id/webViewContainer"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        />

 </ScrollView>
Run Code Online (Sandbox Code Playgroud)

现在问题是当我使用loadDataWithBaseURL()方法在WebViews中加载数据时,WebViews在底部留下了一些额外的空间.无法为此问题找到合适的解决方案.谁能告诉我为什么会这样?

小智 0

WebView webView = new WebView(this);
        webView.loadDataWithBaseURL("about:blank",
                Utils.getHtmlData(article.getContent()), "text/html",
                "utf-8", null);
        rl_wrapper.removeAllViews();
        rl_wrapper.addView(webView);
Run Code Online (Sandbox Code Playgroud)

我使用包装器代替网络视图,英语不是我的母语,但也希望它可以帮助你。