Continuous Shared Element Transitions: RecyclerView to ViewPager
By Shalom Gibly, Software Engineer, Google's Material Gallery Team Transitions in Material Design apps provide visual continuity. As the user navigates the app, views in the app change state. Motion and transformation reinforce the idea that interfaces are tangible, connecting common elements from one view to the next. This post aims to provide guidelines and implementation for a specific continuous transition between Android Fragments. We will demonstrate how to implement a transition from an image in a RecyclerView into an image in a ViewPager and back, using 'Shared Elements' to determine which views participate in the transition and how. We will also handle the tricky case of transitioning back to the grid after paging to an item that was previously offscreen. This is the result we are aiming for: If you wish to skip the explanation and go straight to the code, you can find it here . What are shared elements? A shared element transition determines how views that are pr...