문제

I'm using this library for pagerSlidingTabStrip Component. I have TabStrip which occupies full screen in Portrait Orientation. But In Landscape it doesn't occupy full screen. I'm using app1:paddingLeftRight attribute in tabstrip tag in xml, but it is not working for me. I want to setPadding programmatically for each and every device both in landscape and portrait mode. So I will place the Tabs items equally.

Any Help greatly appreciated...........

Thanks in advance

도움이 되었습니까?

해결책

Try do this in updateTabStyles() in class PagerSlidingTabStrip in library. Something like tab.setPadding(left, top, right, bottom).

다른 팁

This thread might be old, however I found a solution for this. For those who are looking (still) for solution try this :

 tabs.setViewPager(pager);

  /*
      Add top and bottom padding
   */

  LinearLayout parent = (LinearLayout)tabs.getChildAt(0);
  int padding = 20;

  for (int i = 0; i < parent.getChildCount(); i++) {
      View tab = parent.getChildAt(i);
      tab.setPadding(tab.getPaddingLeft(), padding tab.getPaddingRight(), padding);
  }

Put this code after setting your viewpager, or else it will read parent with 0 children.

Cheers, Happy coding.

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