我有问题。我使用以下代码在页面中创建了一个框架:
<Grid BackgroundColor="#212121">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="*" />
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid Grid.Row="1" Margin="20, 0, 20, 0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="30" />
<RowDefinition Height="50" />
<RowDefinition Height="40" />
<RowDefinition Height="40" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image Source="Logo.png" HeightRequest="200" VerticalOptions="End" Margin="30" />
<Entry Grid.Row="1" Placeholder="Username" PlaceholderColor="#bababa" FontSize="16" x:Name="txtUsername" TextColor="White" />
<Entry Grid.Row="2" Placeholder="Email" PlaceholderColor="#bababa" FontSize="16" x:Name="txtEmail" TextColor="White" />
<Entry Grid.Row="3" Placeholder="Password" PlaceholderColor="#bababa" FontSize="16" IsPassword="True" x:Name="txtPassword" TextColor="White" TextChanged="OnPasswordTextChanged" />
<Frame Grid.Row="4" BackgroundColor="Transparent" BorderColor="Transparent" x:Name="FramePasswordStrength" >
<Label Text="Test" BackgroundColor="Purple" TextColor="White" HorizontalOptions="Center" VerticalOptions="Center" x:Name="txtPasswordStrength" FontSize="14" />
</Frame>
<Entry Grid.Row="5" Placeholder="Confirm Password" PlaceholderColor="#bababa" FontSize="16" IsPassword="True" x:Name="txtConfirmPassword" TextColor="White" />
<Button Text="Sign up" FontAttributes="Bold" Clicked="btnRegisterClicked" BackgroundColor="#3897F0" TextColor="White" HeightRequest="50" VerticalOptions="Start" Grid.Row="6" />
</Grid>
</Grid>
问题是我的框架以我想要的方式绘制,但是该框架的中心没有标签。现在,我已经尝试减小FontSize,但这是行不通的。
我在做什么错?
<RowDefinition Height="Auto" />
设置为行的高度,以便它对所有控件都具有正确的高度。