Füllen Sie den Bildschirm mit StackLayout

Habe ich ein StackLayout codiert wie diese:

StackLayout mainStackLayOut = new StackLayout{
    BackgroundColor = Color.Blue,
    //VerticalOptions = LayoutOptions.FillAndExpand,
    //WidthRequest = width,
    HorizontalOptions = LayoutOptions.FillAndExpand,
    Orientation = StackOrientation.Vertical
};

Aber ich will das StackLayout zu füllen, die Bildschirm Breite und Höhe, auch ich habe die Baum-Schaltflächen Hinzugefügt, wie diese:

StackLayout buttonsStackLayOut = new StackLayout
{
    BackgroundColor = Color.White,
    //VerticalOptions = LayoutOptions.Fill,
    HorizontalOptions = LayoutOptions.Fill,
    Orientation = StackOrientation.Horizontal,
    Spacing = 0
};
mainStackLayOut.Children.Add(buttonsStackLayOut);


Image doctorImage = new Image
{
    WidthRequest = width / 3,
    HeightRequest = 50,
    BackgroundColor = Color.Gray,
    Source = ImageSource.FromFile ("about.png")
};
buttonsStackLayOut.Children.Add(doctorImage);

Füllen Sie den Bildschirm mit StackLayout

Wie kann ich füllen Sie alle screensize?

  • was ist das problem? die schwarzen Linien Links und rechts ?
  • Ja, genau das ist das problem
  • haben Sie versucht, explizit festlegen Padding="0"
Schreibe einen Kommentar