嵌套滚动视图中的Recyclerview不滚动,并且折叠布局不折叠

时间:2018-09-17 13:01:33

标签: android android-recyclerview android-coordinatorlayout android-collapsingtoolbarlayout

问题是我的recyclerview没有显示完整的项目,我的折叠式布局也没有折叠。我希望折叠式布局向上滚动直到消失,然后像协调器布局的折叠式布局一样消失。但是折叠的布局不会折叠,并且回收者视图也不会滚动。这是我的代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/White"
    android:orientation="vertical"
    xmlns:shimmer="http://schemas.android.com/tools">

    <com.facebook.shimmer.ShimmerFrameLayout
        android:id="@+id/vwShimmerContainer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        shimmer:duration="800">

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

            <LinearLayout
                android:id="@+id/vwPlaceHolders"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

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

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

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

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

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

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

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


        </LinearLayout>
    </com.facebook.shimmer.ShimmerFrameLayout>
    <android.support.design.widget.CoordinatorLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/rootView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v4.widget.NestedScrollView
            android:id="@+id/nest_scrollview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

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

                <include
                    android:id="@+id/add_review_holder"
                    layout="@layout/content_write_review"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/margin_10"
                    android:layout_marginRight="@dimen/margin_5"
                    android:layout_marginTop="@dimen/margin_15" />

                <View
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/margin_8"
                    android:layout_marginTop="@dimen/margin_15"
                    android:background="@color/colorAppBarBacground"></View>

                <TextView
                    android:id="@+id/tvNoReview"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center"
                    android:textSize="@dimen/textsize_14"
                    android:text="@string/label_no_review"/>


                <android.support.v7.widget.RecyclerView
                    android:id="@+id/rvReviews"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="@dimen/margin_15"
                    android:nestedScrollingEnabled="true"/>
            </LinearLayout>
        </android.support.v4.widget.NestedScrollView>

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:background="@color/White">

            <android.support.design.widget.CollapsingToolbarLayout
                android:id="@+id/collapsing_toolbar_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"

                app:layout_scrollFlags="scroll|exitUntilCollapsed">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:orientation="vertical"
                    android:visibility="visible"
                    app:layout_collapseMode="parallax">

                    <include
                        android:id="@+id/ratingsHolder"
                        layout="@layout/content_restaurant_rating"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/margin_10"
                        android:layout_marginRight="@dimen/margin_5"
                        android:visibility="visible" />

                    <View
                        android:layout_width="match_parent"
                        android:layout_height="@dimen/margin_8"
                        android:layout_marginTop="@dimen/margin_15"
                        android:background="@color/colorAppBarBacground"></View>
                </LinearLayout>
            </android.support.design.widget.CollapsingToolbarLayout>
        </android.support.design.widget.AppBarLayout>
    </android.support.design.widget.CoordinatorLayout>

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

android:nestedScrollingEnabled="true"

我猜应该是假的。