1

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

4

2 回答 2

0

尝试在库中 PagerSlidingTabStrip 类的 updateTabStyles() 中执行此操作。类似的东西tab.setPadding(left, top, right, bottom)

于 2014-01-05T08:20:56.107 回答
0

该线程可能很旧,但是我找到了解决方案。对于那些正在(仍在)寻找解决方案的人,试试这个:

 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);
  }

在设置您的 viewpager之后放置此代码,否则它将读取具有 0 个子级的父级。

干杯,快乐编码。

于 2016-05-30T06:21:41.297 回答