0

我有一个 xml,其中回收站视图无法显示列表的最后一项。我将此布局文件用于 BottomSheetDialogFragment:

    <?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:id="@+id/support_bottom_sheet"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/btm_shape_rounded"
    android:paddingStart="@dimen/padding_btmsheet"
    android:paddingEnd="@dimen/padding_btmsheet"
    app:layout_behavior="android.support.design.widget.BottomSheetBehavior">

    <TextView
        android:id="@+id/txt_title"
        style="@style/TextTitleBtmsheet"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginStart="8dp"
        android:layout_marginTop="25dp"
        android:gravity="center"
        android:text="please select"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toEndOf="@+id/img_close"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageButton
        android:id="@+id/img_close"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@color/transparent"
        app:layout_constraintBottom_toBottomOf="@+id/txt_title"
        app:layout_constraintEnd_toStartOf="@+id/txt_title"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/txt_title"
        app:srcCompat="@drawable/ic_close" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/rcl"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="@dimen/margin_2x"
        android:divider="@color/transparent"
        android:dividerHeight="0dp"
        android:scrollbars="none"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/txt_title"
        app:layout_constraintVertical_bias="0.0"
        tools:listitem="@layout/item_rview_filter_sheet" />

</androidx.constraintlayout.widget.ConstraintLayout>

那么,问题出在哪里,为什么约束布局中的 Recycler 视图不能正确显示最后一项?

如果它的问题我使用这个依赖:

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
4

0 回答 0