liaoinstan / SpringView

🔥 A custom view pull to refresh,support ScrollView,ListView,RecyclerView,WebView and all another views, easy to use
Apache License 2.0
1.93k stars 353 forks source link

CollapsingToolbarLayout、 TabLayout和 Viewpager嵌套RecyclerView 取消上拉时会误触下拉动作 #95

Open StaticCoder opened 5 years ago

StaticCoder commented 5 years ago

问题描述:使用如下布局形式,CollapsingToolbarLayout在折叠状态下,把RecyclerView拉到最底部,再往上拉出脚部局,不松手,然后往下拉把上拉布局隐藏掉,继续往下拉会直接把下拉刷新布局拉出来(这时RecyclerView并未拉到最顶端)。 望作者有时间帮忙看一下,谢啦!

这是上面的viewpager布局 <android.support.design.widget.CoordinatorLayout android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent">

        <android.support.design.widget.AppBarLayout
            android:id="@+id/infoFlowAppBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <android.support.design.widget.CollapsingToolbarLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/white"
                android:fitsSystemWindows="true"
                app:layout_scrollFlags="scroll|exitUntilCollapsed">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/white"
                    android:gravity="center_horizontal"
                    android:orientation="vertical"
                    app:layout_collapseMode="parallax"
                    app:layout_scrollFlags="scroll">

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="24dp"
                        android:layout_marginTop="15dp"
                        android:layout_marginBottom="8.5dp"
                        android:scaleType="fitCenter"
                        android:src="@drawable/ic_home_tools_bottom" />

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="10dp"
                        android:background="@color/gray_F5F5F5" />
                </LinearLayout>
            </android.support.design.widget.CollapsingToolbarLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="46dp"
                android:orientation="horizontal"
                app:layout_collapseMode="pin">

                <com.flyco.tablayout.SlidingTabLayout
                    android:id="@+id/channelTabs"
                    android:layout_width="0dp"
                    android:layout_height="match_parent"
                    android:layout_weight="1"
                    android:background="@color/white"
                    tl:tl_divider_color="@color/white"
                    tl:tl_indicator_color="#3f54d4"
                    tl:tl_indicator_height="3dp"
                    tl:tl_indicator_width_equal_title="true"
                    tl:tl_tab_space_equal="false"
                    tl:tl_textBold="SELECT"
                    app:tl_tab_padding="15dp"
                    tl:tl_textSelectColor="@color/black_202020"
                    tl:tl_textSelectedsize="17sp"
                    tl:tl_textUnselectColor="@color/black_606060"
                    tl:tl_textsize="14sp"
                    tl:tl_underline_color="@color/gray_F5F5F5" />

                <ImageView
                    android:id="@+id/ivAddChannel"
                    android:layout_width="46dp"
                    android:layout_height="match_parent"
                    android:onClick="onClick"
                    android:scaleType="centerCrop"
                    android:src="@drawable/ic_add_channel" />
            </LinearLayout>
        </android.support.design.widget.AppBarLayout>

        <android.support.v4.view.ViewPager
            android:id="@+id/channelsViewpager"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior" />
    </android.support.design.widget.CoordinatorLayout>

这是viewpager里的fragment布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ll_list" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:orientation="vertical">

<com.liaoinstan.springview.widget.SpringView
    android:id="@+id/infoFlowSpringView"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v7.widget.RecyclerView
            android:id="@+id/rvInfoFlowList"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            ></android.support.v7.widget.RecyclerView>

</com.liaoinstan.springview.widget.SpringView>