错误时尝试定制xamarin.android字体 [英] Error when try to customize font in xamarin.android

查看:268
本文介绍了错误时尝试定制xamarin.android字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用xamarin.android的开发应用,我想自定义字体,code:

I used xamarin.android for develop app, I tried to customize font with code:

 Typeface myfont = Typeface.CreateFromAsset (Context.Assets, "fonts/KhmerOS.ttf");

但是当我建,它的错误为以下所示的:

but when I built, it error as shown bellow:

Error CS0120: An object reference is required for the non-static field, method, or property 'Android.Content.Context.Assets.get' (CS0120)

请帮帮我,

最好的方面
Buntha

Best Regard Buntha

推荐答案

这可能是已故的答复,但可能有助于有人用同样的问题。设置BuilAction到Android资产的字体文件。 (右键单击fontfile-> BuildAction的选择AndroidAsset)

This may be the late reply but might help someone with the same issue. Set BuilAction to Android Asset for font file. (Right click on fontfile->BuildAction select AndroidAsset)

这篇关于错误时尝试定制xamarin.android字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆