【发布时间】:2018-07-05 10:15:15
【问题描述】:
我想要一个包含两个列表(RecyclerView)的页面,每个列表都有一个标题(TextView),一个在前一个结束之后开始。但我希望每个人最多有一半的页面。所以在第一个列表有一个项目的情况下,第二个列表将直接放在下面,如果第一个列表很长只占一半页面,第二个列表将从后半部分开始。这是为了如果我希望每个人总是占一半
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/list_one"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/list_two"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
【问题讨论】:
-
您不能对其内容进行回收利用。由于滚动行为是确定内容大小是否大于回收站视图大小
标签: android android-layout android-recyclerview android-linearlayout