2016-07-26 45 views
2

嗨有沒有人知道基於顯示@UI的設備更改字體大小的方法。Xamarin Forms - 根據設備即iPhone/iPad更改字體大小

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

回答

0

您可以使用OnIdiom。例如:

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