RecyclerView Grid Layout Fit items to screen

Viewed 295

I want to fit the items to the screen. When I have 4 four item I used this:

 recyclerView.layoutManager = GridLayoutManager(requireContext(), 2, RecyclerView.VERTICAL, false)

And when I have 20 item I used this code snippet:

recyclerView.layoutManager = GridLayoutManager(requireContext(), 3, RecyclerView.VERTICAL, false)

What I want to do is I want to fit all the items to the screen.

enter image description here

0 Answers
Related