2
在CSS中兩個divs
可以放在一排使用float:left
。兩排佈局在一排
這怎麼能實現Xamarin.Forms?
的代碼,我到目前爲止有:
public class App : Application
{
public App()
{
StackLayout sl2 = new StackLayout();
sl2.WidthRequest = 400;
sl2.HeightRequest = 400;
sl2.BackgroundColor = Color.Red;
sl2.HorizontalOptions = LayoutOptions.Start;
StackLayout sl3 = new StackLayout();
sl3.WidthRequest = 400;
sl3.HeightRequest = 400;
sl3.BackgroundColor = Color.Green;
sl3.HorizontalOptions = LayoutOptions.Start;
StackLayout sl = new StackLayout();
sl.Children.Add(sl2);
sl.Children.Add(sl3);
ContentPage contentPage = new ContentPage();
contentPage.Content = sl;
MainPage = contentPage;
}
}
但我需要的紅色和綠色的佈局將被放在同一排。