This happens due to different system screen sizes and densities.
In terms of usability, if you have a small and fixed number of lines (as in the case of a menu) you can use something like Linearlayout or Constraintlayout and configure it to use all the available size, then distribute the size of the items proportionally to fill the screen.
If the list needs to be dynamic (justifying the use of Recyclerview) and the size of your dataset vary, it might be better not to worry about the "perfectly fill the screen" items - even why after scrolling the top and bottom items will be partially visible. If full display of items is a requirement, a good solution can be to use libraries such as this, that will anchor the scroll of the elements.
If the previous suggestions do not solve the problem, you can dynamically calculate the height of the layout items according to the screen size. This requires obtaining the visible height of Recyclerview, subtracting margins and padding (padding) and split by the number of items to be displayed. The result will be the height of each item, which can be defined in the method onBindViewHolder
of your Adapter.
A simpler solution would be to set the height of the items according to the screen dimensions. A documentation of Android Developers explains how to do this.
Eduardo did not solve until it worsened, because the
RecycleView
was fixed with 4 items without scroll bar.– Ari Melo