我正在尝试在textview中使用自定义字体:
tv=(TextView)findViewById(res);
Typeface font = Typeface.createFromAsset(this.getAssets(), "fonts/font.ttf");
tv.setTypeface(font);
但是当我运行时,出现以下错误:
W/System.err( 542): java.lang.RuntimeException: native typeface cannot be made
有什么问题?
最佳答案
对我来说,这绝对是找不到字体文件时收到的消息。简单的事情如下:
Typeface.createFromAsset(getContext().getAssets(), "fonts/MYFONT.TTF");
当我的字体实际位于font / MYFONT.TTF中时