0

I have a xml in which the recycler view can't show the last item of the list. I use this layout file for a 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>

So, whats the problem and why Recycler view in Constraint Layout does not show last item properly?

and if its matter I use this dependencies:

implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
  • try to add bottom padding like this `android:paddingBottom="?attr/actionBarSize"` in ur `RecyclerView `. – Harshad Pansuriya Feb 26 '20 at 07:05
  • "It doesn't work" isn't descriptive enough to help people understand your problem. Instead, describe what the exact observed behavior is and what the expected behavior should be. For UI issues, a screenshot or video is usually helpful. Please see [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) – Ryan M Feb 26 '20 at 08:10

0 Answers0