【问题标题】:Xamarin Forms - Change the font size as per Device ie iPhone / iPadXamarin Forms - 根据设备更改字体大小,即 iPhone / iPad
【发布时间】:2016-11-29 19:52:58
【问题描述】:

您好,有谁知道根据显示@UI 的设备更改字体大小的方法。

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

我正在使用样式属性。

但在 iPad 上,Large 看起来仍然很小

  <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>

【问题讨论】:

    标签: ios cross-platform xamarin.forms


    【解决方案1】:

    您可以使用OnIdiom。例如:

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

    【讨论】:

      猜你喜欢
      • 2020-08-21
      • 1970-01-01
      • 2017-01-24
      • 1970-01-01
      • 2018-05-01
      • 1970-01-01
      • 2015-09-09
      • 1970-01-01
      • 2020-04-24
      相关资源
      最近更新 更多