webview-in-coordinatorlayout icon indicating copy to clipboard operation
webview-in-coordinatorlayout copied to clipboard

NestedWebview's Scroll not same as in CollapsingToolbarLayout

Open kelalaka153 opened this issue 5 years ago • 0 comments

I've come into this library with stackoverflow suggestions to Android bug with Webview and NestedScrollView.

The replacement is very easy and I've got rid of the app crush on large web pages. However, the scrolling not same as the default CollapsingToolbarLayout.

  1. The webview scroll into the CollapsingToolbar as soon as scrolling started.
  2. The CollapsingToolbar coming down very fast on down scrool

I think the CollapsingToolbar and the webview scrolls together.

Can we solve this?

XML

<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".ArticleReaderActivity"
    >

<com.google.android.material.appbar.AppBarLayout
        android:id="@+id/app_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:fitsSystemWindows="true"
        android:theme="@style/ThemeOverlay.MaterialComponents.ActionBar.Primary">

    <com.google.android.material.appbar.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbarLayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleTextAppearance="@style/ExpandedAppBar"
            app:collapsedTitleTextAppearance="@style/CollapsedAppBar"
            app:expandedTitleGravity="bottom|center_horizontal"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <ImageView
                android:id="@+id/imageview_section_reader"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="fitXY"
                app:layout_collapseMode="parallax"
                android:contentDescription="@string/desc"
                />

        <include layout="@layout/toolbar"/>

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

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


<com.test.NestedWebView
        android:id="@+id/webviev_section_reader"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"/>`

 </androidx.coordinatorlayout.widget.CoordinatorLayout>

kelalaka153 avatar Jul 01 '19 14:07 kelalaka153