当我尝试在 Xamarin.Forms 上创建新标签时,我收到以下警告:
about = new Label { Text = "" ,
TextColor=Color.Black,
Font = Font.SystemFontOfSize(16),//Warning occurred here
XAlign = TextAlignment.End,
HorizontalOptions = LayoutOptions.EndAndExpand};
"Xamarin.Forms.Label.Font"已过时:"请使用字体 类本身的属性。在 v1.3.0 中已过时
这个警告意味着什么,我应该怎么做?
请改用Label
类的FontSize
、FontFamily
和FontAttributes
属性。
https://developer.xamarin.com/guides/xamarin-forms/user-interface/text/fonts/
您应该只听警告并将其更改为FontSize
。在 Xamarin.Forms
的下一版本中,可以删除此属性,并且代码将不再编译。
库的维护者经常使用将某些方法/属性标记为过时来警告用户,在库的下一个版本中可以删除此特定成员。