RecyclerView's heighet set on wrap content, yet in studio it is as tall as two screens

35 Views Asked by At

It works just fine when I run the app, but when working in studio the height of the recycler view is as tall as 1.5-2 screens which really slows down the work flow because I need to either scroll a lot or set it to match constraint and just change it back to wrap content before everytime I run the app. Has anyone experienced this before? First time for me.

This is my recycler, can't see anything here that should make this happen:

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/itinerary_sample_photos_recycler"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
app:layout_constraintTop_toBottomOf="@+id/itinerary_youtube_player_card"
app:layout_constraintEnd_toEndOf="@+id/itinerary_youtube_player_card"
app:layout_constraintStart_toStartOf="@+id/itinerary_youtube_player_card"/>

And this is how it looks. Notice, the area at the bottom where it says "buy 6.99" is a floating container fixed at the bottom of the screen. The recycler view stretches inside the scroll layout. It is selected so you can see the outline. enter image description here

1

There are 1 best solutions below

0
Anjan Debnath On

When you are using Constraint layout then it is worth using MATCH_CONSTRAINT that means 0dp for both width and height.

android:layout_width="0dp"
android:layout_height="0dp"