Xamarin.Forms字体已过时

时间:2016-03-16 15:06:20

标签: c# xamarin.forms portable-class-library

当我尝试在 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'

中已废弃

这个警告意味着什么,我应该做什么?

2 个答案:

答案 0 :(得分:3)

请改用/** * This method is called by the system to give a Thread * a chance to clean up before it actually exits. */ private void exit() { if (group != null) { group.threadTerminated(this); group = null; } /* Aggressively null out all reference fields: see bug 4006245 */ target = null; /* Speed the release of some of these resources */ threadLocals = null; inheritableThreadLocals = null; inheritedAccessControlContext = null; blocker = null; uncaughtExceptionHandler = null; } 班级的FontSizeFontFamilyFontAttributes属性。

https://developer.xamarin.com/guides/xamarin-forms/user-interface/text/fonts/

答案 1 :(得分:1)

您应该只听取警告并将其更改为FontSize。 在Xamarin.Forms的下一版本中,可以删除此属性,并且您的代码将不再编译。

库的维护者经常使用将某些方法/属性标记为过时的方式来警告用户可以在下一版本的库中删除此特定成员。