在Recyclerview中,当在应用程序栏中使用框架布局时,滚动无法在片段内部工作

时间:2018-07-23 10:02:52

标签: android android-layout android-recyclerview fragment android-collapsingtoolbarlayout

在Android Recyclerview中,当在应用栏布局中使用框架布局时,滚动条在片段内部不起作用

<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/appbar">


                                        <android.support.design.widget.AppBarLayout
                                            android:id="@+id/app_bar"
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:background="#F9F9F9"
                                            android:theme="@style/MyTabLayout"
                                            app:elevation="0dp">

    //Collapsing bar layout code start

                                            <android.support.design.widget.CollapsingToolbarLayout
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_`enter code here`content"
                                                app:layout_scrollFlags="scroll|enterAlways">

                          <FrameLayout
                                                android:id="@+id/frameLayout"
                                                android:layout_width="match_parent"
                                                android:layout_height="wrap_content"
                                                android:layout_below="@+id/app_bar"
                                                android:layout_marginTop="10dp"
                                                app:layout_behavior="@string/appbar_scrolling_view_behavior" />
                         </android.support.design.widget.CollapsingToolbarLayout>
                          </android.support.design.widget.AppBarLayout>
                          </android.support.design.widget.CoordinatorLayout>

            Fragment code below which include NestedScrollView

                        <?xml version="1.0" encoding="utf-8"?>
                        <android.support.v4.widget.NestedScrollView 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="#4DEBEBEB"
                            app:layout_behavior="@string/appbar_scrolling_view_behavior">


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

                                <android.support.v7.widget.RecyclerView
                                    android:id="@+id/item_rv_insurance"
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content"
                                    android:nestedScrollingEnabled="false"
                                    android:scrollbars="vertical"
                                    app:layout_behavior="@string/appbar_scrolling_view_behavior" />


                            </LinearLayout>
                        </android.support.v4.widget.NestedScrollView>

0 个答案:

没有答案