Line spacing between Stacklayout - Xamarin Forms
I have a stacklayout that has three labels. But when I show there is a space between these labels. I want to avoid space. Can anyone help me which property will avoid this problem.
Thanks for your help in advance
+3
Nagashree siddalingappa
source
to share
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
Pete
source
to share