我想更改我的 TextView 的字体,我遵循教程和示例中给出的代码。但是我在其中遇到错误。 我的代码是
var txt = FindViewById<TextView> (Resource.Id.textView1);
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/k010.ttf");
txt.SetTypeface (tf, TypefaceStyle.Normal);
我在第二行收到错误消息
The object refrance is required for non static field,method
我想在我的 TextView 中使用 kruti dev 10 字体。
最佳答案
改变
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/k010.ttf");
到
Typeface tf = Typeface.CreateFromAsset (Application.Context.Assets, "fonts/k010.ttf");
关于c# - 在 xamarin for android 中更改字体时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20437882/