[英]Coordinator Layout with 2 Recycler Views
我想用這種布局構建一個android片段:
當底部的RecyclerView朝底部滾動時,我希望頂部的折疊起來並隱藏(並在底部視圖滾動到頂部時打開)。
協調器布局似乎是答案,但是我遇到的每個示例在頂部均使用AppBarLayout。 包含片段的活動已經顯示了一個應用欄。 我不想修改它。
我如何在CoordinatorLayout中實現這兩個RecyclerView設置,而無需解決應用程序欄?
您可以使用NestedScrollView
(垂直方向的LinearLayout
作為NestedScrollView
子NestedScrollView
,並將兩個RecyclerView
都添加為LinearLayout
樣品
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.