簡體   English   中英

Xamarin Forms: Html label is showing blank content in ios

[英]Xamarin Forms: Html label is showing blank content in ios

我正在使用Xam.Plugin.HtmlLabel在我的項目中顯示數據。 它在 android 和 windows 上運行良好。 但是 ios 設備中沒有顯示任何內容。

我的代碼:

<htmllabel:HtmlLabel
    x:Name="message_label"
    VerticalOptions="Start"
    VerticalTextAlignment="Center"
    TextColor="Black">
    <htmllabel:HtmlLabel.FontSize>
        <OnIdiom x:TypeArguments="x:Double">
            <OnIdiom.Phone>20</OnIdiom.Phone>
            <OnIdiom.Tablet>30</OnIdiom.Tablet>
            <OnIdiom.Desktop>20</OnIdiom.Desktop>
        </OnIdiom>
    </htmllabel:HtmlLabel.FontSize>
</htmllabel:HtmlLabel>


message_label.Text = "htmldata";

我在這里上傳了一個示例供參考。

在您的情況下,您似乎忘記在特定平台上初始化渲染器。

在 iOS

using LabelHtml.Forms.Plugin.iOS;
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
   HtmlLabelRenderer.Initialize();
   global::Xamarin.Forms.Forms.Init();
   LoadApplication(new App());

   return base.FinishedLaunching(app, options);
}

我使用標簽<u>在 label 的行下添加。

在此處輸入圖像描述

您可以從https://github.com/luczha/HtmlLabel_demo查看演示。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM