找不到Android Runtime Exception字体资产 [英] Android Runtime Exception font asset not found

查看:62
本文介绍了找不到Android Runtime Exception字体资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码和屏幕截图,我试图设置自定义字体,但是在字体文件位于资产文件夹中时,运行时异常发生,找不到字体资产.我想念什么吗?

Here is my code and screenshot I'm trying to set custom font typeface but Runtime exception occurs font asset not found while font file is in asset folder. Am I missing something ?

Typeface font = Typeface.createFromAsset(getAssets(), "font/terminal.ttf");
((TextView) findViewById(R.id.weatherHeadingTV)).setTypeface(font);

推荐答案

我尝试了另一个效果很好的字体文件,因此得出结论,较早的字体文件已损坏.谢谢@Miduhun MP,@Gowtham Raj和@jagan reddy

I have tried another font file that worked fine So I conclude that earlier font file was corrupt. Thanks @Miduhun MP , @Gowtham Raj and @jagan reddy

这篇关于找不到Android Runtime Exception字体资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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