我在 Constraint Layout 中有一个 Recycler View,用来展示来自数据库的数据。我想将其最大高度设为 500dp,但问题是当超过这个大小时,它会从视图底部剪切一部分。
我不知道问题出在哪里。
以下是 RecyclerView 的 xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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="fill_parent"
android:layout_height="wrap_content"
android:maxHeight="500dp"
tools:context=".histDialog">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:padding="3dp"
app:layout_constrainedHeight="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
RecyclerView出现在一个样式为对话框的活动中。
我尝试了我所能想到的一切,但是它就是无法工作。