I am using viewpager2 with shared element transition. Sometimes it works and sets current item to required position, but sometimes it is half way between the required position i.e. Half view from left and right position are shown.
viewPager.setAdapter(imageDisplayAdapter); viewPager.setCurrentItem(position);
I have also tried with OnGlobalLayoutListener, OnPreDrawListener, postRun etc but it did not worked.
2.1m questions
2.1m answers
60 comments
57.0k users