2014-09-24 81 views

回答

4

使用StackLayout間距屬性爲項目之間的間距調整。

下面舉例說明這一點: -

 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); 
+0

我用spacing.Even則有 – 2014-09-25 13:23:40

+1

之間間距你們是不是上面的例子中,或東西在自己的應用程序?你也試過這個平臺? – Pete 2014-09-25 13:54:09

+0

我正在嘗試在我的應用程序中。我正在Xamarin工作。 – 2014-09-26 05:03:16