I use in my Shared Element Transition application with ViewPager.

When I exit the ViewPager, I must map the position of the ViewPager list to the position of the RecyclerView.

Actually I need to find this item in RecyclerView.

But the problem is that if this element is not visible, then I cannot find this hidden element in the list. Null returns to me.

How to find a list item view if it is not loaded yet in RecyclerView?

    1 answer 1

    It is impossible. View exists only for what is shown, prepare to be shown, or has just been shown. If there are 100 thousand values ​​in your list, generating View for all is wasteful, that's why they are generated only for N displayed. You can increase the number of items stored in the cache (potential View), but this is the path to nowhere. You need to rewrite adapters and logic to work not with View, but with position in RecyclerView

    • Or become the position of this item in the list. - Nuclominus