CoordinatorLayout协调布局上下不联动问题

背景:本来想顶部就作为头部整个整体滑动,下方能加载更多的。结果发现上面滑上面的,底部滑底部的。上方滑出屏幕后,就拉不回来了,这奇葩问题

和之前代码对比,没错啊。懵逼了

给下我的布局,照道理结构和配置是和我一样的

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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.support.design.widget.CoordinatorLayout
    android:id="@+id/cl_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/rl_title"
    android:layout_marginTop="@dimen/dimen_20dp"
    android:orientation="vertical">

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


        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsingtoolbarlayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:contentScrim="@android:color/transparent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed">

            <LinearLayout
                android:id="@+id/member_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                app:layout_collapseMode="none"
                >

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

                <android.support.constraint.ConstraintLayout
                    android:id="@+id/mmf_banner_top_cl"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dimen_26dp">


                    <android.support.v7.widget.CardView
                        android:layout_width="match_parent"
                        android:layout_height="64dp"
                        android:layout_marginLeft="@dimen/dimen_15dp"
                        android:layout_marginRight="@dimen/dimen_15dp"
                        app:cardCornerRadius="10dp"
                        app:cardElevation="0dp">

                        <com.youth.banner.Banner
                            android:id="@+id/mmf_banner_top"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            app:image_scale_type="center_crop" />
                    </android.support.v7.widget.CardView>


                </android.support.constraint.ConstraintLayout>

                <LinearLayout
                    android:id="@+id/ll_financial"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dimen_26dp"
                    android:background="@color/white"
                    android:orientation="vertical"
                    android:paddingBottom="@dimen/dimen_0dp"
                    android:visibility="visible">

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

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/financial_ry"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/dimen_10dp"
                        android:layout_marginRight="@dimen/dimen_10dp"
                        android:background="@color/white"
                        android:nestedScrollingEnabled="false"
                        android:overScrollMode="never"

                        android:visibility="gone" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/ll_equity_package"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dimen_8dp"
                    android:background="@color/white"
                    android:orientation="vertical">

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

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/equity_package_ry"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/dimen_5dp"
                        android:layout_marginTop="@dimen/dp_10"
                        android:layout_marginRight="@dimen/dimen_5dp"
                        android:layout_marginBottom="@dimen/dimen_10dp"
                        android:nestedScrollingEnabled="false"
                        android:overScrollMode="never" />

                    <include layout="@layout/item_equity_package_bottom" />
                </LinearLayout>

                <LinearLayout
                    android:id="@+id/ll_selected_benefits"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dimen_8dp"
                    android:background="@color/white"
                    android:orientation="vertical"
                    android:paddingBottom="@dimen/dimen_16dp">

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

                    <android.support.v7.widget.RecyclerView
                        android:id="@+id/selected_benefits_ry"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/dimen_5dp"
                        android:layout_marginRight="@dimen/dimen_5dp"
                        android:nestedScrollingEnabled="false"
                        android:overScrollMode="never" />
                </LinearLayout>

                <android.support.constraint.ConstraintLayout
                    android:id="@+id/mmf_banner_bottom_cl"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/dimen_8dp">


                    <android.support.v7.widget.CardView
                        android:layout_width="match_parent"
                        android:layout_height="64dp"
                        android:layout_marginLeft="@dimen/dimen_15dp"
                        android:layout_marginRight="@dimen/dimen_15dp"
                        app:cardCornerRadius="10dp"
                        app:cardElevation="0dp">

                        <com.youth.banner.Banner
                            android:id="@+id/mmf_banner_bottom"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            app:image_scale_type="center_crop" />
                    </android.support.v7.widget.CardView>

                </android.support.constraint.ConstraintLayout>

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


            </LinearLayout>

        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>
    <!-- 若ViewPager中的Fragment用到了实现了NestedScrollingChild接口的控件,则ViewPager外部不需要套一层NestScrollView,反之,则需要嵌套一层NestScrollView -->
    <com.scwang.smartrefresh.layout.SmartRefreshLayout
        android:id="@+id/smart_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/bg_bill_f8"
        android:visibility="visible"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        app:srlEnablePreviewInEditMode="false">
        <!--@string/appbar_scrolling_view_behavior 改变layout_behavior -->
        <!--srlAccentColor srlPrimaryColor 将会改变 Header 和 Footer 的主题颜色-->
        <!--srlEnablePreviewInEditMode 可以开启和关闭预览功能-->



        <android.support.v7.widget.RecyclerView
            android:id="@+id/select_goods_rv"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="@dimen/dimen_10dp"
            android:layout_marginTop="@dimen/dimen_10dp"
            android:layout_marginRight="@dimen/dimen_10dp"
            android:overScrollMode="never"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
             />

        <com.scwang.smartrefresh.layout.footer.ClassicsFooter
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:srlClassicsSpinnerStyle="Translate" />
    </com.scwang.smartrefresh.layout.SmartRefreshLayout>
</android.support.design.widget.CoordinatorLayout>



</FrameLayout>

如果和我的一样,肯定的是布局是没问题

问题出在:你代码那边是不是写了rv.setNestedScrollingEnabled(false);

需要改为true

解决了是不是很开心。。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章