Xamarin Forms 应用程序在重建时不加载空间
Xamarin Forms app not loading spaces when rebuild
嘿嘿开发者,
我的 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 忽略 end tags[= 前面的空格的问题38=] 只需使用  
.
的 Unicode 值
这里的问题是,一旦我重建了整个应用程序(它通过 Hot Reload 工作,而它是 运行)这些空间被忽略了。它不断产生输出:
This sentence containsa whole lot offormated strings!
使用 xml:space="preserve"
对此没有任何影响,而且这导致了另一个错误。
希望您对如何解决这个问题有任何想法。
提前致谢!
如何保留空格
为此,您必须使用 Span 的文本 属性,如下所示
<Span TextColor="red" Text="This sentence contains "/>
为什么 在 HotReload 中工作?
我可以重现您感兴趣的问题。我的猜测是问题出在 HotReload 以及它是如何在幕后实现的。如果你有时间,如果你 post github 中的问题就好了。
嘿嘿开发者,
我的 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 忽略 end tags[= 前面的空格的问题38=] 只需使用  
.
这里的问题是,一旦我重建了整个应用程序(它通过 Hot Reload 工作,而它是 运行)这些空间被忽略了。它不断产生输出:
This sentence containsa whole lot offormated strings!
使用 xml:space="preserve"
对此没有任何影响,而且这导致了另一个错误。
希望您对如何解决这个问题有任何想法。
提前致谢!
如何保留空格
为此,您必须使用 Span 的文本 属性,如下所示
<Span TextColor="red" Text="This sentence contains "/>
为什么 在 HotReload 中工作?
我可以重现您感兴趣的问题。我的猜测是问题出在 HotReload 以及它是如何在幕后实现的。如果你有时间,如果你 post github 中的问题就好了。