Line spacing between Stacklayout - Xamarin Forms
1 answer
Use the StackLayout Spacing property to adjust the spacing between items.
Following is shown: -
StackLayout objStackLayout = new StackLayout()
{
Orientation = StackOrientation.Vertical,
Spacing = 0
};
Label objLabel1 = new Label();
objLabel1.BackgroundColor = Color.Red;
objLabel1.Text = "Red";
objStackLayout.Children.Add(objLabel1);
Label objLabel2 = new Label();
objLabel2.BackgroundColor = Color.Green;
objLabel2.Text = "Green";
objLabel2.Font = Font.OfSize("Arial", 48);
objStackLayout.Children.Add(objLabel2);
Label objLabel3 = new Label();
objLabel3.BackgroundColor = Color.Blue;
objLabel3.Text = "Blue";
objLabel3.Font = Font.OfSize("Arial", 48);
objStackLayout.Children.Add(objLabel3);
+4
source to share