如何将水平RecyclerView与底部对齐?

问题描述

如何将水平RecyclerView对准底部?例如,我有一个水平RecyclerView和一个LinearLayoutManager,看起来像这样:

enter image description here

但是我希望所有RecyclerView项都与底线对齐,如下所示:

enter image description here

有什么办法做到这一点?

UPD 这是我的物品布局:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <ImageView
        android:id="@+id/columnImageView"
        android:layout_width="@dimen/column_width"
        android:layout_height="match_parent"
        android:layout_marginHorizontal="@dimen/spacing_xs"
        android:src="@drawable/graph_rectangle_white_b"
        android:contentDescription="@null"
        tools:layout_height="@dimen/spacing_3xl"
        tools:visibility="visible"
        tools:src="@drawable/graph_rectangle_blue_a" />

</layout>

那是我的RecyclerView的布局:

<?xml version="1.0" encoding="utf-8"?>
<layout>

    <merge xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/grey_200">

        ...

        <View
            android:id="@+id/line5"
            android:layout_width="0dp"
            android:layout_height="1dp"
            android:background="@color/grey_400"
            app:layout_constraintBottom_toBottomOf="@id/main"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent" />


        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/chartRecyclerView"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:overScrollMode="never"
            android:layout_marginHorizontal="@dimen/spacing_xs"
            app:layout_constraintHorizontal_weight="1"
            app:layout_constraintBottom_toBottomOf="@id/line5"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            android:layout_alignBottom="@id/line5"
            tools:layout_height="wrap_content"
            tools:itemCount="5"
            tools:listitem="@layout/chart_column_item"
            tools:spanCount="5" />

    </merge>
</layout>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)