setMargins

fun View.setMargins(@Px left: Int, @Px top: Int, @Px right: Int, @Px bottom: Int)

Set 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


fun View.setMargins(@Px size: Int)

Set this view's margins.

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

Receiver

View

Parameters

size

the margin size (px).

See also