【发布时间】:2016-10-17 09:45:23
【问题描述】:
我在 xamarin 表单中应用了如下所示的按钮属性。它在 iOS 上运行良好,但在 android 上会出现问题。
Button anyButton = new Button ();
anyButton.Text = "Men";
anyButton.FontFamily = "HelveticaNeue-Light" ;
anyButton.FontSize = 16;
anyButton.TextColor = Color.Black;
anyButton.FontAttributes = FontAttributes.None;
附上具有相同属性的相同视图的屏幕截图。与 iOS 相比,Android 中的按钮文本看起来有点粗体。 我尝试通过为 Android 创建按钮渲染器并将属性指定为
Typeface fontStyle = Typeface.Create("HelveticaNeue-Light", TypefaceStyle.Normal);
Control.SetTextColor(Android.Graphics.Color.ParseColor(Colors.BLACK_COLOR));
Control.SetTextSize(Android.Util.ComplexUnitType.Sp, 16);
Control.Typeface = fontStyle;
但仍然面临无法在 android 中的按钮文本上应用“浅色”字体的问题。
【问题讨论】:
标签: xamarin.android xamarin.forms custom-font font-family