在Xamarin.forms中的Label的Text属性部分应用斜体效果

时间:2015-07-11 07:34:29

标签: c# xamarin xamarin.ios xamarin.forms

这是我在Xamarin.forms中的片段。

all()

我需要制作“Italic”Italic字体和粗体“Bold”。

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:9)

我解决了。

var fs = new FormattedString ();
fs.Spans.Add (new Span { Text="Italic", ForegroundColor = Color.Gray, FontSize = 20, FontAttributes = FontAttributes.Italic });
fs.Spans.Add (new Span { Text=", Bold", ForegroundColor = Color.Gray, FontSize = 20, FontAttributes = FontAttributes.Bold });
labelFormatted.FormattedText = fs;