我在下面描述我的问题:
这是我的布局
<?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>
现在,我要在LinearLayout(id:stop_layout)滚动到顶部并将此布局粘在顶部时停止NestedScrollView,然后RecyclerView可以滚动
当我向下滚动而RecyclerView滚动到顶部时,则NestedScrollView可以再次滚动,而RecyclerView无法滚动。