質問

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