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

解決了是不是很開心。。

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