我有一个Xamarin Forms应用程序。我的页面底部应该长成这样:
我该如何在Grid中扩展StackLayout?我希望蓝色和红色背景可以在中间相遇。
目前它看起来像这样:
问题是StackLayout不能扩展以填充空间。这是我的XAML代码:<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand" VerticalOptions="End" Spacing="0" >
<Grid ColumnSpacing="0" RowSpacing="0" HorizontalOptions="FillAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<StackLayout HorizontalOptions="CenterAndExpand" Grid.Column="0" Grid.Row="1" BackgroundColor="Blue" >
<Label Text="First" TextColor="#FFFFFF" HorizontalOptions="CenterAndExpand" />
</StackLayout>
<StackLayout HorizontalOptions="CenterAndExpand" Grid.Column="1" Grid.Row="1" BackgroundColor="Red" >
<Label Text="Second" TextColor="#FFFFFF" HorizontalOptions="CenterAndExpand" />
</StackLayout>
</Grid>
</StackLayout>
我该如何在Grid中扩展StackLayout?我希望蓝色和红色背景可以在中间相遇。
33.3*
作为宽度吗?对于两列,可以设置为50*
。 - Alberto MéndezCenterAndExpand
? - Alberto Méndez