I want to understand by what principle GridLayoutManager calculates row heights.

Two rows of the table have photos of different sizes:

enter image description here

and GridLayoutManager calculates them on a 480 * 800 device:

enter image description here

And as an example looks like:

enter image description here

With the width of photos, everything is simple - there is a sum of 4 photos - 600 px, and there is 480px - the width of the display. 600/480 = 1.25 Then for each photo 150 / 1.25 = 120, along with the padding, what you need comes out. RecyclerView has

 android:layout_width="match_parent" android:layout_height="wrap_content" 

And how to understand and deal with the height? Why is the first row 174px and the second 159px?

    0