2014-09-24 79 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