1

我有一个NestedScrollViewor RecyclerViewwithpaddingTop = 60dp例如和 with cliptopadding = false。我需要RecyclerView滚动(使用)之前的60dpAppBarLayout$ScrollingViewBehaviorAppBarLayout$ScrollingViewBehavior嵌套滚动动作。我尝试在总滚动达到 60dp 边界之前禁用侦听器setNestedScrollingEnabled(false)中的嵌套滚动而RecyclerView.OnScrollListener不是启用它,但是在向下滚动事件期间我遇到了很多问题。那么是否有任何默认的实现技巧可以使所有工作正常进行。这是屏幕截图,它是标准的CoordinatorLayoutxml 文件

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:background="@android:color/white">

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

        <android.support.design.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:background="@android:color/transparent"
            android:fitsSystemWindows="true">

            <android.support.design.widget.AppBarLayout
                android:id="@+id/main.appbar"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@android:color/transparent"
                android:fitsSystemWindows="true"
                android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

                <android.support.design.widget.CollapsingToolbarLayout
                    android:id="@+id/main.collapsing"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:fitsSystemWindows="true"
                    android:minHeight="?actionBarSize"
                    app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
                    app:titleEnabled="false">

                    <android.support.design.widget.TabLayout
                        android:id="@+id/main.tab"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="bottom"
                        android:background="?attr/colorPrimary"
                        android:minHeight="?actionBarSize"
                        app:tabGravity="fill"
                        app:tabMaxWidth="0dp"
                        app:tabMode="fixed" />


                    <FrameLayout
                        android:id="@+id/main.backdrop"
                        android:layout_width="match_parent"
                        android:layout_height="200dp"
                        app:layout_collapseMode="parallax" />


                </android.support.design.widget.CollapsingToolbarLayout>


            </android.support.design.widget.AppBarLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"
                app:layout_behavior="@string/appbar_scrolling_view_behavior">


                <android.support.v4.widget.NestedScrollView
                    android:id="@+id/aaabbb"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_marginLeft="20dp"
                    android:layout_marginRight="20dp"
                    android:paddingTop="60dp"
                    android:clipToPadding="false"
                    android:clipChildren="false"
                    android:background="@android:color/white"

                    >

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:lineSpacingExtra="8dp"
                        android:padding="@dimen/activity_horizontal_margin"
                        android:text="@string/lorem"
                        android:textSize="20sp" />
                </android.support.v4.widget.NestedScrollView>

            </LinearLayout>

        </android.support.design.widget.CoordinatorLayout>


    </LinearLayout>
</FrameLayout>

在此处输入图像描述

4

0 回答 0