我试图实现某种聊天问题(垂直RecyclerView),并有垂直Recyclerview下的答案(水平RecyclerView) 我已经设法实现了我在我心中,但: 现在我有: 垂直rv工作正常,水平rv在视图的底部; 我想要的是: 我想要在垂直rv下面找到答案,因为它会展开,所以如果垂直rv有一个itemview,它应该在它的正下方,并且随着它展开直到水平rv到达视图的底下面的水平RecyclerView纵向RecyclerView
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/verticalRecyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbars="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/horizontalRecyclerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="horizontal"/>
</LinearLayout>
无法正常工作,垂直回收站下方有很多空的空间,即使它只有一个物品,一旦其填充,水平recyclerview下面有很多空间 – Dude
您必须为回收站查看重量如果您设置了wrap_content,则回收站视图会在其包含时隐藏较低的回收站视图更多的项目 –
是的,但这样,我最终有布局中间的水平rv直到垂直视图填充,然后一旦它填充,horionztal recyclerview下面有空的空间 – Dude