本地字体不能进行 [英] Native typeface cannot be made

查看:121
本文介绍了本地字体不能进行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自定义字体设置的Andr​​oid Studio..I一直保持.TTF字体文件中SRC-主要资产的字体文件夹,我打字在这个活动code -

I am trying to set custom font in Android Studio..I have kept .ttf font file inside src-main-assets-fonts folder and i am typing this code in activity-

 Typeface avenirdemifont ;
avenirdemifont = Typeface.createFromAsset(this.getAssets(), "avenirdemifont.ttf");

            TextView textView = (TextView) findViewById(R.id.textView5);
            textView.setTypeface(avenirdemifont);

我收到以下错误字样本土无法进行

I am getting following error "native typeface cannot be made"

推荐答案

看来你忘了添加目录字体设置路径。试试这个:

It seems you forgot to add "fonts" directory to path. Try this:

 Typeface.createFromAsset(this.getAssets(), "fonts/avenirdemifont.ttf");

这篇关于本地字体不能进行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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