在 Xamarin.forms 中的 Label 的 Text 属性 部分应用斜体效果
Apply italic effect in the part of Text property of Label in Xamarin.forms
这是我在 Xamarin.forms 中的片段。
grid.Children.Add (new Label {Text = "Italic, Bold",
XAlign = TextAlignment.Center,
YAlign = TextAlignment.Center,
FontSize = 30
}, 1, 1);
我需要制作 "Italic" 斜体和粗体 "Bold"。
谁能帮帮我?
我解决了
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;
这是我在 Xamarin.forms 中的片段。
grid.Children.Add (new Label {Text = "Italic, Bold",
XAlign = TextAlignment.Center,
YAlign = TextAlignment.Center,
FontSize = 30
}, 1, 1);
我需要制作 "Italic" 斜体和粗体 "Bold"。
谁能帮帮我?
我解决了
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;