【问题标题】:Xamarin Stack iconXamarin 堆栈图标
【发布时间】:2021-09-06 05:17:43
【问题描述】:

由于我们正在使用字体很棒的 Xamarin,

我们有一个带有图标的 Xamarin 按钮。 我们想在 Xamarin 中实现字体真棒堆栈图标。我们如何在 Xamarin 中做到这一点。

`

<ImageButton>
    <ImageButton.Source>
        <FontImageSource FontFamily="FontAwesome"
                         Glyph="{x:Static fonts:IconFont.AddressBook}"
                         Color="{AppThemeBinding Dark=White,
                                                 Light=Black}"/>
    </ImageButton.Source>
</ImageButton>

` 我们想要的样本:

https://www.w3schools.com/icons/tryit.asp?filename=tryicons_awesome_intro_stack

【问题讨论】:

    标签: xamarin font-awesome


    【解决方案1】:

    您提供的代码用于从字体文件加载字体。您可以参考下面链接中的步骤。 https://stackoverflow.com/a/65095438/11850033

    需要在github上下载Font Awesome 4.7.0第一种形式。

    如果你想从 html 加载图标,你可以使用 webview。

    var browser = new WebView();
    var htmlSource = new HtmlWebViewSource();
    htmlSource.Html = @"<html><body>
      <h1>Xamarin.Forms</h1>
      <p>Welcome to WebView.</p>
      </body></html>";
    browser.Source = htmlSource;
    

    有关如何加载 html 的更多详细信息,您可以查看以下链接。https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=windows#html -字符串

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多