core-ktx / androidx.view / android.view.ViewGroup.MarginLayoutParams

Extensions for android.view.ViewGroup.MarginLayoutParams

setMargins

fun MarginLayoutParams.setMargins(size: Int): Unit

Sets the margins in the ViewGroup's MarginLayoutParams. This version of the method sets all axes to the provided size.

updateMargins

fun MarginLayoutParams.updateMargins(left: Int = leftMargin, top: Int = topMargin, right: Int = rightMargin, bottom: Int = bottomMargin): Unit

Updates the margins in the ViewGroup's MarginLayoutParams. This version of the method allows using named parameters to just set one or more axes.

updateMarginsRelative

fun MarginLayoutParams.updateMarginsRelative(start: Int = marginStart, top: Int = topMargin, end: Int = marginEnd, bottom: Int = bottomMargin): Unit

Updates the relative margins in the ViewGroup's MarginLayoutParams. This version of the method allows using named parameters to just set one or more axes.