Reputation: 1433
I need to show the 2nd page of viewPager. After
viewPager.setCurrentItem(1);
it really shows the 2nd page. BUT PagerSlidingTabStrip shows the 3rd page... And then if I scroll to any direction - tabs update itself and look/switch correct. And this problem I see only at Nexus-4, but not at the Nexus-5, HTC ONE and other devices...
Upvotes: 2
Views: 734
Reputation: 1433
I've found the reason, why this is happening. In my code I added a margin to viewPager.
final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
.getDisplayMetrics());
pager.setPageMargin(pageMargin);
And if you remove this margin - you will solve this problem particular. I don't have other ways
Upvotes: 4