2017-09-01 76 views
-2

這是我的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

你的XAML看起來incoplete –

回答

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>