Achieve the smooth bi-directional infinite scrolling ViewPager 2
You can slide from the very first view till the last view and that’s it. You can’t scroll backward to the last view from the first view and forward from the last view to the first view. This problem can make it cumbersome for the user to scroll through views on the ViewPager2.
So, our target is to make the user able to scroll directly from the first view to the last view with backward scroll and from the last view to the first view with forward scroll. So basically to make a workaround for infinite scrolling views on the ViewPager2 we have to go like