Scroll Margin or ViewPort Size in RecyclerView

asked 2021-04-25T01:27:41.447+00:00
Nathan Sokalski 3,976 Reputation points

I'm not quite sure what to call it, but here goes. I have a number of RecyclerView(s) for which I need to synchronize the scrolling. These RecyclerView(s) have differing numbers of items (some fitting on screen, some not), and not all of the RecyclerView(s) are visible at the same time. I am able to synchronize the visible RecyclerView(s), but only if the RecyclerView requires scrolling (if all of the RecyclerView's items fit on screen, the scroll synchronization does not work). What I basically need to do is make the content of all the RecyclerViews the same height. I tried to set the height of the last item in the OnBindViewHolder method, but this does not seem to be doing anything. I think the recycling feature of RecyclerView is causing problems with this by not always updating the properties when necessary or by trying to use values that are not what is expected because some items have not yet been rendered. Is there a way to make all RecyclerView(s) have the same amount of scrollable area? Thanks.

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
4,803 questions
{count} votes