【发布时间】:2021-11-17 04:47:32
【问题描述】:
嘿嘿开发者,
我的 Xamarin.Forms Android 应用程序遇到了一个有趣的问题。
我的 XAML 如下所示:
<Label>
<Label.FormattedText>
<FormattedString>
<Span TextColor="red">This sentence contains </Span>
<Span FontAttributes="Bold">a whole lot of </Span>
<Span TextDecorations="Underline">formatted strings!</Span>
</FormattedString>
</Label.FormattedText>
</Label>
如您所见,我通过简单地使用 解决了 XAML 忽略末尾 标签 前面的空格的问题&#160; 的 Unicode 值。
这里的问题是,一旦我重建整个应用程序(它在运行时通过 Hot Reload 工作),这些空间将被忽略。它不断产生输出:
This sentence containsa whole lot offormated strings!
使用xml:space="preserve"对此没有任何影响,而且这导致了另一个错误。
希望您对如何解决这个问题有任何想法。
提前致谢!
【问题讨论】:
-
会不会是你缺少一个 x ?喜欢“Š”
标签: xaml xamarin.forms xamarin.android