Xamarin Forms-根据设备更改字体大小,如iPhone / iPad

3

Hello,有人知道如何根据显示@UI的设备更改字体大小的方法吗?

例如:

// iPhone 5
if (UIScreen.MainScreen.Bounds.Height == 568)
    FontSize = 12
else 
     24pixles on IPad

我正在使用样式属性。

但是在iPad上,即使使用“大号”字体,看起来仍然很小。

  <Style x:Key="lblDetailValueHighlighted" TargetType="Label">
    <Setter Property="TextColor" Value="Blue" />
    <Setter Property="FontSize">
      <Setter.Value>
        <OnPlatform x:TypeArguments="NamedSize" iOS="Large" Android="Large" WinPhone="Medium" />

      </Setter.Value>
    </Setter>
    <Setter Property="Margin" Value="3,1,3,3" />
  </Style>
1个回答

0

您可以使用OnIdiom。例如:

<OnIdiom x:TypeArguments="StackOrientation">
    <OnIdiom.Phone>Vertical</OnIdiom.Phone>
    <OnIdiom.Tablet>Horizontal</OnIdiom.Tablet>
</OnIdiom>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接