문제

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...

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top