val slidingTabStrip = tabs.getChildAt(0) as ViewGroup for (i in 0 until slidingTabStrip.childCount - 1) { val v = slidingTabStrip.getChildAt(i) val p = v.getLayoutParams() as ViewGroup.MarginLayoutParams p.setMargins(0, 0, 0, 0) val scale = resources.displayMetrics.density var pxl = resources.getDimensionPixelSize(R.dimen.gap1) val padding_in_dp = 3 val padding_in_px = (padding_in_dp * scale + 0.5f).toInt() v.setPadding(pxl, pxl, pxl, pxl) }
Sunday, May 13, 2018
android kotlin tablayout child tab ViewGroup.MarginLayoutParams setMargins, setPadding with padding dp to px
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment