Android 如何按顺序折叠布局?

Android 如何按顺序折叠布局?,android,android-coordinatorlayout,android-collapsingtoolbarlayout,Android,Android Coordinatorlayout,Android Collapsingtoolbarlayout,我正在尝试制作折叠工具栏,在哪里 工具栏始终位于同一空间 当我向下滚动时,塌陷_2应该首先塌陷,只有在塌陷_1之后才会塌陷 当我滚动到顶部时,塌陷_1始终输入,塌陷_2仅在recyclerview内容丰富的顶部输入 但是,在我的布局中,两个块同时移动(或者,如果我将两个相对布局放置在同一个折叠布局中,则两个块作为一个块移动) 我通过以下形式实现了它。折叠2是位于折叠1下方的边距,也是唯一的滚动标志。折叠时,有一个“始终输入”和“模式”引脚,该引脚将折叠1保持在适当位置,直到有额外的未折叠空间

我正在尝试制作折叠工具栏,在哪里

  • 工具栏始终位于同一空间
  • 当我向下滚动时,塌陷_2应该首先塌陷,只有在塌陷_1之后才会塌陷
  • 当我滚动到顶部时,塌陷_1始终输入,塌陷_2仅在recyclerview内容丰富的顶部输入
但是,在我的布局中,两个块同时移动(或者,如果我将两个相对布局放置在同一个折叠布局中,则两个块作为一个块移动)


我通过以下形式实现了它。折叠2是位于折叠1下方的边距,也是唯一的滚动标志。折叠时,有一个“始终输入”和“模式”引脚,该引脚将折叠1保持在适当位置,直到有额外的未折叠空间

  <android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white">

    <android.support.design.widget.CollapsingToolbarLayout
      android:id="@+id/ll_collapsing"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:minHeight="56dip"
      android:orientation="vertical"
      app:layout_scrollFlags="scroll|exitUntilCollapsed">


      <RelativeLayout
        android:id="@+id/colapsing_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="285dp"
        app:layout_collapseMode="parallax"
        app:layout_scrollFlags="scroll">
      </RelativeLayout>

      <LinearLayout
        android:id="@+id/colapsing_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="56dip"
        android:orientation="vertical"
        app:layout_collapseMode="pin"
        app:layout_scrollFlags="scroll|enterAlways">

      </LinearLayout>

      <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="56dip"
        android:background="@color/white"
        android:minHeight="56dip"
        app:layout_collapseMode="pin">
      </android.support.v7.widget.Toolbar>
    </android.support.design.widget.CollapsingToolbarLayout>


  </android.support.design.widget.AppBarLayout>

  <android.support.design.widget.AppBarLayout
    android:id="@+id/app_bar_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white">

    <android.support.design.widget.CollapsingToolbarLayout
      android:id="@+id/ll_collapsing"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:minHeight="56dip"
      android:orientation="vertical"
      app:layout_scrollFlags="scroll|exitUntilCollapsed">


      <RelativeLayout
        android:id="@+id/colapsing_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="285dp"
        app:layout_collapseMode="parallax"
        app:layout_scrollFlags="scroll">
      </RelativeLayout>

      <LinearLayout
        android:id="@+id/colapsing_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="56dip"
        android:orientation="vertical"
        app:layout_collapseMode="pin"
        app:layout_scrollFlags="scroll|enterAlways">

      </LinearLayout>

      <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="56dip"
        android:background="@color/white"
        android:minHeight="56dip"
        app:layout_collapseMode="pin">
      </android.support.v7.widget.Toolbar>
    </android.support.design.widget.CollapsingToolbarLayout>


  </android.support.design.widget.AppBarLayout>