updateMargins

fun View.updateMargins(@Px left: Int = marginLeft, @Px top: Int = marginTop, @Px right: Int = marginRight, @Px bottom: Int = marginBottom)

Updates this view's margins.

This view layout params need to be a ViewGroup.MarginLayoutParams, if not will be ignored.

Receiver

View

Parameters

left

the left margin (px).

top

the top margin (px).

right

the right margin (px).

bottom

the bottom margin (px).

See also


@JvmName(name = "updateHVMargins")
fun View.updateMargins(@Px horizontal: Int = -1, @Px vertical: Int = -1)

Updates this view's horizontal or vertical margins.

This view layout params need to be a ViewGroup.MarginLayoutParams, if not will be ignored.

Receiver

View

Parameters

horizontal

the horizontal margin (px).

vertical

the vertical margin (px).

See also


fun ViewGroup.MarginLayoutParams.updateMargins(@Px horizontal: Int = -1, @Px vertical: Int = -1)

Updates this view's horizontal or vertical margins.

Receiver

ViewGroup.MarginLayoutParams

Parameters

horizontal

the horizontal margin (px).

vertical

the vertical margin (px).

See also