【问题标题】:Native typeface cannot be made无法制作原生字体
【发布时间】:2014-10-11 08:17:12
【问题描述】:

我正在尝试在 Android Studio 中设置自定义字体。我已将 .ttf 字体文件保存在 src-main-assets-fonts 文件夹中,并且我在活动中输入此代码-

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

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

我收到以下错误“无法制作原生字体”

【问题讨论】:

标签: android fonts


【解决方案1】:

您似乎忘记在路径中添加“字体”目录。试试这个:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-23
    • 1970-01-01
    • 2014-05-12
    • 2018-04-23
    • 2013-12-01
    • 1970-01-01
    • 2018-07-20
    相关资源
    最近更新 更多