Skip to content

Instantly share code, notes, and snippets.

@siscofran999
Created January 31, 2020 18:18
Show Gist options
  • Save siscofran999/c151fc9f881737396ec237bdd89d197e to your computer and use it in GitHub Desktop.
Save siscofran999/c151fc9f881737396ec237bdd89d197e to your computer and use it in GitHub Desktop.
val tabs = tabLayout.getChildAt(0) as ViewGroup
for (i in 0 until tabs.childCount - 1) {
val tab = tabs.getChildAt(i)
val layoutParams = tab.layoutParams as LinearLayout.LayoutParams
layoutParams.marginEnd = dpToPx(resources, 8f).toInt()
layoutParams.marginStart = dpToPx(resources, 8f).toInt()
tab.layoutParams = layoutParams
tabLayout.requestLayout()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment