Nestedscrollview/Scrollview内的Webview缺少内容

Ahs*_*sim 6 android android-webview android-nestedscrollview

我有一个webview,它放在nestedscrollview中.我面临的问题是webview没有加载整页.相反,它会加载页面的一部分,然后将底部空白保留为空白(白色).

我也试过了scrollview.

输出我得到:

输出我得到了

我的webview代码:

private ImageButton backButton;
    private WebView webView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_article);

        backButton = findViewById(R.id.backButton);
        webView=(WebView)findViewById(R.id.webView);
        webView.setWebViewClient(new MyBrowser());
//        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
//            descriptionView.setText(Html.fromHtml(data, Html.FROM_HTML_MODE_COMPACT));
//        } else {
//            descriptionView.setText(Html.fromHtml(data));
//        }
        webView.getSettings().setJavaScriptEnabled(true);

        webView.loadUrl("file:///android_asset/html/test.html");

        backButton.setOnClickListener(this);
    }

    private class MyBrowser extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    }
Run Code Online (Sandbox Code Playgroud)

布局文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".Activities.ArticleActivity">


    <RelativeLayout
        android:id="@+id/topBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimary">

        <ImageButton
            android:id="@+id/backButton"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_centerVertical="true"
            android:layout_marginLeft="10dp"
            android:background="@null"
            card_view:srcCompat="@drawable/outline_arrow_back_ios_24" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="20dp"
            android:layout_centerInParent="true"
            android:layout_margin="20dp"
            android:scaleType="centerInside"
            android:src="@drawable/x01" />
    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/topBar">

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

            <android.support.v7.widget.CardView
                android:id="@+id/card_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_margin="10dp"
                card_view:cardCornerRadius="2dp">


                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_gravity="center"
                    android:orientation="vertical">

                    <ImageView
                        android:id="@+id/iconView"
                        android:layout_width="match_parent"
                        android:layout_height="120dp"
                        android:layout_centerVertical="true"
                        android:scaleType="centerCrop"
                        android:src="@drawable/article" />

                    <com.virtual_antivirus.virtualantivirus.Utlis.BanglaTextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="10dp"
                        android:layout_marginLeft="10dp"
                        android:layout_marginRight="10dp"
                        android:layout_marginTop="10dp"
                        android:text="????????? ???????? ???????? ?????"
                        android:textColor="@android:color/black"
                        android:textSize="18sp"
                        android:textStyle="bold" />

                    <LinearLayout
                        android:layout_width="100dp"
                        android:layout_height="5dp"
                        android:layout_marginLeft="10dp"
                        android:background="@color/colorAccent"></LinearLayout>

                    <FrameLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:minHeight="300dp">

                        <WebView
                            android:id="@+id/webView"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent" />
                    </FrameLayout>


                </LinearLayout>


            </android.support.v7.widget.CardView>
        </ScrollView>

    </LinearLayout>


    <View
        android:layout_width="match_parent"
        android:layout_height="5dp"
        android:layout_below="@+id/topBar"
        android:background="@drawable/shadow" />

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

pra*_*ala 0

使用

机器人:fillViewport =“真”

内部滚动视图属性