错误显示“当前上下文中不存在名称'字体'”
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
TextView title = FindViewById<TextView>(Resource.Id.title);
var font = Typeface.CreateFromAsset(Assets, "FluoGums.ttf");
title.Typeface = font;
}
}
答案 0 :(得分:0)
你可以这样做。
在资源目录中创建一个新的字体目录,并将FluoGums.ttf
字体文件放在此处
在onCreate()
方法
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
TextView title = (TextView) findViewById(R.id.title);
AssetManager assetManager = getAssets();
Typeface tf = Typeface.createFromAsset(assetManager, "fonts/FluoGums.ttf");
title.setTypeface(tf);
}