Xamarin.Forms 中 FontSizes 的缩放像素
Scaled Pixels for FontSizes in Xamarin.Forms
我在大屏幕上遇到字体大小问题。
默认情况下,我的标签在我的小 android phone 上看起来很完美。
<Label HorizontalTextAlignment="Center"
Text="Lobby"
FontSize="16" />
当我切换到我的 Amazon Fire 平板电脑时,标签非常非常小。几乎所有东西都太小了。
我已阅读,Android 个项目有一个单元 "sp"。在 Xamarin.Forms 中有内置的方法吗?有图书馆可以帮助我吗?
我已经看过了:
。不幸的是我正在使用 Xamarin.Forms.
提前致谢!
如果您使用 PCL,请尝试使用 Device.Idiom。根据设备类型,您可以添加不同的图像尺寸。
https://developer.xamarin.com/api/type/Xamarin.Forms.Device/
https://developer.xamarin.com/api/property/Xamarin.Forms.Device.Idiom/
您可以使用 NamedSize 枚举来确定字体大小。
可用的是:
- 微型
- 小
- 中
- 大
例如:
<Label Text="Login" FontSize="Large"/>
<Label Text="Instructions" FontSize="Small"/>
我在大屏幕上遇到字体大小问题。
默认情况下,我的标签在我的小 android phone 上看起来很完美。
<Label HorizontalTextAlignment="Center"
Text="Lobby"
FontSize="16" />
当我切换到我的 Amazon Fire 平板电脑时,标签非常非常小。几乎所有东西都太小了。
我已阅读,Android 个项目有一个单元 "sp"。在 Xamarin.Forms 中有内置的方法吗?有图书馆可以帮助我吗?
我已经看过了:
提前致谢!
如果您使用 PCL,请尝试使用 Device.Idiom。根据设备类型,您可以添加不同的图像尺寸。
https://developer.xamarin.com/api/type/Xamarin.Forms.Device/
https://developer.xamarin.com/api/property/Xamarin.Forms.Device.Idiom/
您可以使用 NamedSize 枚举来确定字体大小。 可用的是:
- 微型
- 小
- 中
- 大
例如:
<Label Text="Login" FontSize="Large"/>
<Label Text="Instructions" FontSize="Small"/>