Domanda

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

È stato utile?

Soluzione

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

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top