Skip to content

和CoordinatorLayout搭配使用时WebView的viewport大小不对 #6

Description

@kutear

image

比如上面的知乎的页面可以看到 WebView实际的高度不止屏幕中的那部分

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true">

        <androidx.appcompat.widget.Toolbar
            android:id="@+id/web_act_toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:contentInsetStartWithNavigation="56dp"
            app:layout_scrollFlags="scroll|enterAlways" />

        <com.google.android.material.progressindicator.LinearProgressIndicator
            android:id="@+id/web_act_progress_bar"
            android:layout_width="match_parent"
            android:layout_height="2dp"
            android:visibility="gone" />

    </com.google.android.material.appbar.AppBarLayout>

    <com.example.nestedscrollwebview.NestedScrollWebView
        android:id="@+id/web_act_webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions