【问题标题】:Uno Platform:Font not displaying correctly on AndroidUno 平台:字体在 Android 上无法正确显示
【发布时间】:2019-12-31 01:59:05
【问题描述】:

我从概念验证 Uno App 开始。我已经实现了一个在 UWP 和 IOS 中运行良好的导航视图。该问题存在于 android 版本中,字形显示不正确。我将字体从 windows 复制到 Android 部分的 Assets/Fonts 目录中。这是一段相关的代码

                    <NavigationViewItem Content="Connect" x:Name="B">
                    <NavigationViewItem.Icon>
                        <FontIcon FontFamily="Segoe MDL2 Assets"   Glyph="&#xEBDB;"/>
                    </NavigationViewItem.Icon>
                </NavigationViewItem>

我使用上面的 Segoe MDL2 Assets 字体。我可能只是不理解这些例子。任何帮助,将不胜感激。谢谢。

【问题讨论】:

  • 你把Build Action: AndroidAsset复制到Assets/Fonts目录后设置了吗?,可以参考Font in Android
  • 我确实将 Build Action 设置为 AndroidAsset,正如您所提到的。我看到了你提到的页面,可以试一试——我现在希望在 xaml 中做所有事情。你觉得在c sharp文件中这样做更有优势吗?
  • 我认为它们是等价的

标签: c# android xamarin fonts uno-platform


【解决方案1】:

尝试使用完全限定的路径,例如:

<FontIcon FontFamily="Assets/Fonts/Segoe MDL2 Assets"   Glyph="&#xEBDB;"/>

您可以在文档中找到有关在 Uno 平台上使用自定义字体的指南:https://platform.uno/docs/articles/using-uno-ui.html#custom-fonts

【讨论】:

  • 我试过了,但没有帮助。我正在考虑改用 pathicon 。制作路径会更加困难 - 但我尝试过它并发送到工作。
  • 还有一篇关于此的新博文:blog.mzikmund.com/2020/01/custom-fonts-in-uno-platform
  • 感谢您的博文——写得非常好。不幸的是,它不能解决问题。我确实将 Uno 包切换到开发包,它解决了一个问题——但不是这个问题。我尝试了另一种字体 - 字体很棒,但它也不起作用。我认为问题在于控件本身,因为 IOS、UWP 和 WASM 部件工作正常。
猜你喜欢
  • 2013-07-19
  • 2012-05-25
  • 2020-12-10
  • 2021-04-03
  • 2013-05-12
  • 1970-01-01
  • 1970-01-01
  • 2011-10-08
  • 2015-12-30
相关资源
最近更新 更多