Udostępnij za pośrednictwem


ViewGroup.MarginLayoutParams.SetMargins(Int32, Int32, Int32, Int32) Method

Definition

Sets the margins, in pixels.

[Android.Runtime.Register("setMargins", "(IIII)V", "GetSetMargins_IIIIHandler")]
public virtual void SetMargins (int left, int top, int right, int bottom);
[<Android.Runtime.Register("setMargins", "(IIII)V", "GetSetMargins_IIIIHandler")>]
abstract member SetMargins : int * int * int * int -> unit
override this.SetMargins : int * int * int * int -> unit

Parameters

left
Int32

the left margin size

top
Int32

the top margin size

right
Int32

the right margin size

bottom
Int32

the bottom margin size

Attributes

Remarks

Sets the margins, in pixels. A call to android.view.View#requestLayout() needs to be done so that the new margins are taken into account. Left and right margins may be overridden by android.view.View#requestLayout() depending on layout direction. Margin values should be positive.

Java documentation for android.view.ViewGroup.MarginLayoutParams.setMargins(int, int, int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to