XAML字体大小适用于iOS,但不适用于Android

时间:2018-10-13 14:09:58

标签: xaml font-size

这是我的XAML:

 <View.Resources>
    <Style x:Key     ="windowTitleStyle"
           TargetType="Label">
        <Setter Property="FontSize"
                Value   ="Large" />
        <Setter Property="FontAttributes"
                Value   ="Bold" />
        <Setter Property="TextColor"
                Value   ="Black" />
    </Style>
    <Style x:Key     ="fieldTitleStyle"
           TargetType="Label">
        <Setter Property="FontSize"
                Value   ="Small" />
        <Setter Property="TextColor"
                Value   ="Gray" />
    </Style>
    <Style x:Key     ="fieldContentStyle"
           TargetType="Label">
        <Setter Property="FontSize"
                Value   ="Large" />
        <Setter Property="FontAttributes"
                Value   ="Bold" />
        <Setter Property="TextColor"
                Value   ="Black" />
    </Style>
</View.Resources>
<StackLayout>
    <Label HorizontalTextAlignment="Center"
           VerticalOptions        ="CenterAndExpand"
           Text                   ="Dispatch Prepared"
           FontAttributes         ="Bold"
           BackgroundColor        ="Transparent" />
    <Label Style="{StaticResource Key=fieldTitleStyle}"
           Text ="Time" />
    <Label x:Name         ="dispatchTime"
           Style          ="{StaticResource Key=fieldContentStyle}"
           BackgroundColor="Transparent"
           Text           ="{Binding StartTimeAsString}"
           FontSize       ="Medium"
           VerticalOptions="CenterAndExpand" />
    <Label Style="{StaticResource Key=fieldTitleStyle}"
           Text ="Address" />
    <Label x:Name         ="dispatchData"
           Style          ="{StaticResource Key=fieldContentStyle}"
           BackgroundColor="Transparent"
           Text           ="{Binding Details}"
           FontSize       ="Medium"
           VerticalOptions="CenterAndExpand" />
    <Button Opacity        ="0.95"
            CornerRadius   ="12"
            BackgroundColor="Transparent"
            VerticalOptions="FillAndExpand"
            TextColor      ="Black"
            Text           ="Revise It"
            FontSize       ="Medium" />
    <Button x:Name         ="dispatchItButton"
            Opacity        ="0.95"
            CornerRadius   ="12"
            BackgroundColor="Green"
            TextColor      ="White"
            VerticalOptions="FillAndExpand"
            Text           ="Dispatch It"
            FontSize       ="Medium" />
</StackLayout>

这些都是奇怪的事情:在iOS上,似乎可以使用不同的字体大小,但是在Android上,所有字体大小都相同。但是,即使在iOS上,大字体也仅适用于fieldTitleStyle元素,不适用于fieldContentStyle元素。

请多多帮助。

0 个答案:

没有答案