This sample shows how to use ViewPager2 with RecyclerView and TabLayout (Mediator), for manage your own state saving by ViewModel
As the former ViewPager, the newer ViewPager2 is generated from ViewGroup. There are few differences between them. Here's an image that depicts the ViewPager2:
- Support RTL direction (Right to Left)
- Support Adapter with RecyclerView
- Support Orintation Horizontal/Veritcal
- Support PageChangeCallback (More efficient code)
- etc