Skip to content

Instantly share code, notes, and snippets.

@kostovtd
Created November 2, 2016 19:00
Show Gist options
  • Save kostovtd/32f85333fa92e72a00fa3495190d58aa to your computer and use it in GitHub Desktop.
Save kostovtd/32f85333fa92e72a00fa3495190d58aa to your computer and use it in GitHub Desktop.
A way to add margins between the tabs of a TabLayout
for(int i=0; i < mTabLayout.getTabCount(); i++) {
View tab = ((ViewGroup) mTabLayout.getChildAt(0)).getChildAt(i);
ViewGroup.MarginLayoutParams p = (ViewGroup.MarginLayoutParams) tab.getLayoutParams();
p.setMargins(0, 0, 50, 0);
tab.requestLayout();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment