【发布时间】:2017-06-01 18:00:08
【问题描述】:
我正在开发一个使用 font.otf 文件的应用程序。我的应用程序将在 android、ios、windows 10 和 windows 8.1 上运行。我需要为我的标签创建样式以设置字体系列。 对于 android 和 ios,我引用了这个 link
我在这样的 xaml 页面中尝试过-
<Label.FontFamily>
<OnPlatform x:TypeArguments="x:String">
<OnPlatform.iOS></OnPlatform.iOS>
<OnPlatform.Android>Lobster-Regular.ttf#Lobster-Regular</OnPlatform.Android>
<OnPlatform.WinPhone></OnPlatform.WinPhone>
</OnPlatform>
</Label.FontFamily>
new Label {
Text = "Hello, Forms!",
FontFamily = Device.OnPlatform (
null,
null,
@"\Assets\Fonts\Lobster-Regular.ttf#Lobster-Regular"
// Windows Phone will use this custom font
)
}
但是当我运行我的应用程序时,字体没有为 Windows 10 和 8.1 设置。
如何为 Windows 10 和 8.1 设置字体系列。 或者有没有更有效的方法来应用覆盖所有平台的字体系列?
【问题讨论】:
标签: c# xamarin.forms portable-class-library xamarin.uwp