Skip to content Skip to sidebar Skip to footer

Recyclerview Flows Over The Screen

I have a fragment that replaces FrameLayout. In this fragment, if I had only RecyclerView, I could set its height to match_parent and everything could work well. However, if I have

Solution 1:

You have to constrain your RecyclerView's bottom and set the height to "match constraint". Change this

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recycler_leaderboard"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@id/divider" />

to

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recycler_leaderboard"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/divider"/>

You should also NOT use match_parent in children of ConstraintLayout.

Post a Comment for "Recyclerview Flows Over The Screen"