【问题标题】:How to use a label to dispaly the combination of string and URL with underline如何使用标签显示字符串和带下划线的 URL 组合
【发布时间】:2019-10-04 17:45:16
【问题描述】:

我正在使用一个 bel 来显示字符串,它是字符串和 url 的组合。

例如: 请参阅此:https://www.google.com/https://www.google.com/ 观看此。

我需要在同一个标​​签中显示整个字符串,但 URL 应该加下划线。

如何做到这一点。

【问题讨论】:

    标签: xaml xamarin.forms label


    【解决方案1】:

    使用FormattedText

    <Label>
      <Label.FormattedText>
        <FormattedString>
          <Span Text="First " />
          <Span TextDecorations="Underline" Text="http://www.google.com" />
          <Span Text=" Third" />
        </FormattedString>
      </Label.FormattedText>
    </Label>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-06
      • 1970-01-01
      • 2011-11-17
      • 1970-01-01
      • 2020-03-31
      • 2019-08-17
      • 1970-01-01
      • 2014-05-01
      相关资源
      最近更新 更多