这是我的XAML:
<Grid x:Name="emptyGrid" Grid.Row="0" Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="80*" />
<RowDefinition Height="20*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Padding="20" HorizontalOptions="Center" VerticalOptions="Center">
<Label x:Name="emptyLabel1" FontSize="18" XAlign="Center" TextColor="Gray" />
<Label x:Name="emptyLabel2" FontSize="18" XAlign="Center" TextColor="Gray" />
<Label x:Name="emptyLabel3" FontSize="18" XAlign="Center" TextColor="Gray" />
</Grid>
我所有的2-5行标签都显示在彼此之上,但我希望他们能够均匀地填写给他们的空间:
答案 0 :(得分:0)
使用StackLayout将它们水平或垂直放置在彼此旁边并设置VerticalOptions,以便它们填充它们给出的空间:
<Grid Grid.Row="0" Padding="20" HorizontalOptions="Center" VerticalOptions="Center">
<StackLayout>
<Label x:Name="emptyLabel1" FontSize="18" XAlign="Center" TextColor="Gray" VerticalOptions="FillAndExpand" />
<Label x:Name="emptyLabel2" FontSize="18" XAlign="Center" TextColor="Gray" VerticalOptions="FillAndExpand" />
<Label x:Name="emptyLabel3" FontSize="18" XAlign="Center" TextColor="Gray" VerticalOptions="FillAndExpand" />
</StackLayout>
</Grid>