【发布时间】:2019-12-25 00:36:57
【问题描述】:
我有问题。我使用以下代码在我的页面中创建了一个框架:
<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,但这不起作用。
我做错了什么?
【问题讨论】:
-
它对我来说很好用。您是否尝试过任何正常的故障排除步骤 - 重新启动、重新启动 VS、清理/重建您的解决方案等?
-
另外,您是否尝试过明确设置标签的背景颜色?
-
是的,刚刚尝试了所有建议的选项。等一下,我会给你完整的代码!
-
我将完整代码添加到问题中
标签: xamarin xamarin.forms xamarin.android xamarin.ios