共用方式為


Layout.Padding Property

Definition

Gets or sets the inner padding of the Layout.

public Xamarin.Forms.Thickness Padding { get; set; }
member this.Padding : Xamarin.Forms.Thickness with get, set

Property Value

The Thickness values for the layout. The default value is a Thickness with all values set to 0.

Remarks

The padding is the space between the bounds of a layout and the bounding region into which its children should be arranged into.

The following example shows setting the padding of a Layout to inset its children.

var stackLayout = new StackLayout {
  Padding = new Thickness (10, 10, 10, 20),
  Children = {
    new Label {Text = "Hello"},
    new Label {Text = "World"}
  }
}

Applies to