Scrollview внутри NestedScrollview, и Scrollview можно прокручивать - PullRequest
0 голосов
/ 20 декабря 2018

Я опишу свою проблему ниже:
Это мой макет

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto">
    <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent"
                  android:orientation="vertical">

        <com.coldwizards.library.MyToolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize">
        </com.coldwizards.library.MyToolbar>

        <androidx.core.widget.NestedScrollView
                android:id="@+id/nest_scroll_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fillViewport="true"
                android:scrollbars="none"
                app:layout_behavior="@string/appbar_scrolling_view_behavior">
            <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:orientation="vertical">

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

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

                <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="400dp">
                    <TextView android:layout_width="match_parent" android:layout_height="match_parent"
                              android:text="asdf"/>

                </RelativeLayout>

                <include layout="@layout/divider_layout"
                         android:layout_width="match_parent"
                         android:layout_height="1dp"
                         android:layout_marginBottom="@dimen/margin_small"/>

                <FrameLayout
                        android:id="@+id/tree_view_container"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content">
                </FrameLayout>

                <include layout="@layout/divider_layout"
                         android:layout_width="match_parent"
                         android:layout_height="1dp"
                         android:layout_marginTop="@dimen/margin_small"/>

                <LinearLayout
                        android:id="@+id/stop_layout"
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">
                    <TextView android:layout_width="match_parent"
                              android:layout_height="50dp"
                              android:text="Title"
                              android:textSize="@dimen/font_h6"
                              android:textColor="@color/black"
                              android:gravity="center_vertical"
                              android:paddingLeft="@dimen/margin_medium"
                              android:background="@color/white"/>

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


                    <com.google.android.material.tabs.TabLayout
                            android:id="@+id/tab_layout"
                            android:layout_width="match_parent"
                            android:layout_height="56dp"
                            app:tabIndicatorColor="@color/white"
                            app:tabBackground="@color/colorPrimary"
                            android:layout_gravity="top">

                        <com.google.android.material.tabs.TabItem
                                android:layout_width="10dp"
                                android:layout_height="match_parent"
                                android:text="Tab1"/>
                        <com.google.android.material.tabs.TabItem
                                android:layout_width="10dp"
                                android:layout_height="match_parent"
                                android:text="Tab2"/>
                        <com.google.android.material.tabs.TabItem
                                android:layout_width="10dp"
                                android:layout_height="match_parent"
                                android:text="Tab3"/>
                        <com.google.android.material.tabs.TabItem
                                android:layout_width="10dp"
                                android:layout_height="match_parent"
                                android:text="Tab4"/>

                    </com.google.android.material.tabs.TabLayout>
                    <androidx.recyclerview.widget.RecyclerView
                            android:id="@+id/recycler_view"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent">

                    </androidx.recyclerview.widget.RecyclerView>

                </LinearLayout>

            </LinearLayout>
        </androidx.core.widget.NestedScrollView>
    </LinearLayout>
</layout>

Теперь я хочу остановить NestedScrollView, когда LinearLayout (id: stop_layout) прокручивается вверх, а этот макет закреплен сверху, а затемRecyclerView может прокручиваться

Когда я прокручиваю вниз и RecyclerView прокручиваю вверх, тогда NestedScrollView может прокручиваться снова, RecyclerView не может прокручивать.

...