我有一个高度为match_parent的RecyclerView
,在适配器中显示16个具有固定高度的垂直项。除了涉及不同屏幕尺寸时,一切运作良好。在较大的屏幕上,16个项目显示后底部会保留一些空间,而在小屏手机上,则完全适合底部。我正在寻找一种方式,可以使列表项的高度根据RecyclerView
高度调整到末尾且不能滚动。
查看下面的屏幕截图以获得更多澄清:
问题:
期望:
我的方法是将项目重量设置为1,因此当渲染16次进入RecyclerView
时,它们将在RecyclerView
内共享相同的高度。不幸的是,这对我没有起作用。
我的RecyclerView
如下:
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_morning"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never" />
我的适配器:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@color/white"
android:clickable="false"
android:orientation="vertical">
<TextView />
</LinearLayout>