Nestedscrollview运行不正常

时间:2018-04-17 16:28:17

标签: android android-recyclerview nestedscrollview

在我的应用程序中,我必须将recyclelerview放在一些信息和一些照片之下,我正在测试活动,但它不能很好地工作,我不知道为什么!

任何人都可以帮助我,我只需要将所有东西卷起来就像一件事。我尝试了很多解决方案,但没有解决我的问题

here is a video for my issue

XML:

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

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

        <android.support.design.widget.CollapsingToolbarLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/collapsing_toolbar"
            android:fitsSystemWindows="true"
            app:layout_scrollFlags="scroll|enterAlways|snap"
            app:contentScrim="@color/colorPrimary"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp">

            <android.support.v7.widget.Toolbar
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:id="@+id/toolbar_layout"
                android:layout_gravity="top"
                app:layout_collapseMode="parallax"
                app:popupTheme="@style/AppTheme.PopupOverlay">

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="?attr/actionBarSize"
                    android:dividerPadding="8dp"
                    android:orientation="horizontal"
                    android:showDividers="end">

                    <TextView
                        android:id="@+id/toolbar_title"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        style="@style/TextAppearance.AppCompat.Widget.ActionBar.Title"
                        android:padding="8dp"
                        android:paddingLeft="16dp"
                        android:paddingRight="16dp"
                        android:text="Upload Item"
                        android:textColor="@color/white"
                        android:gravity="center_vertical" />

                    <TextView
                        android:id="@+id/toolbar_save"
                        style="@style/TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:background="?attr/selectableItemBackground"
                        android:drawablePadding="8dp"
                        android:drawableRight="@drawable/done"
                        android:gravity="center_vertical"
                        android:paddingLeft="16dp"
                        android:paddingRight="16dp"
                        android:textAllCaps="true"
                        android:layout_alignParentTop="true"
                        android:layout_alignParentStart="true" />
                </RelativeLayout>
            </android.support.v7.widget.Toolbar>
        </android.support.design.widget.CollapsingToolbarLayout>
    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.SwipeRefreshLayout
        android:layout_width="match_parent"
        android:id="@+id/swipe_to_refresh"
        android:layout_height="match_parent"
        android:layout_below="@+id/coordinate_layout"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <android.support.v4.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/relative1">

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="200dp"
                        android:src="@drawable/shoes"
                        android:id="@+id/profile_imagee" />

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="200dp"
                        android:src="@drawable/shoes"
                        android:id="@+id/profile_imagee1"
                        android:layout_below="@+id/profile_imagee" />

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="200dp"
                        android:src="@drawable/shoes"
                        android:id="@+id/profile_imagee2"
                        android:layout_below="@+id/profile_imagee1" />

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="change profile"
                        android:layout_below="@+id/profile_imagee2"/>
                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@+id/relative1">

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

                    <android.support.v4.widget.SwipeRefreshLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent" />
                </RelativeLayout>
            </RelativeLayout>
        </android.support.v4.widget.NestedScrollView>
    </android.support.v4.widget.SwipeRefreshLayout>
</android.support.design.widget.CoordinatorLayout>

1 个答案:

答案 0 :(得分:0)

在recyclerview中添加属性 在xml中,nestedScrollingEnabled为false,它将解决你的问题