我应该把“ttf"放在哪里?Android项目中的文件? [英] Where should I put the "ttf" files in an Android project?
本文介绍了我应该把“ttf"放在哪里?Android项目中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用字体在我的项目中使用字体.我将 "font.ttf"
复制到assets"文件夹中名为fonts"的文件夹中.但是eclipse不允许编译它.它在字体文件夹上显示错误.我该怎么办?
I'm trying to use fonts in my project using Typeface. I copied the "font.ttf"
into a folder named "fonts" inside "assets" folder. But eclipse do not allow to compile it. It shows an error on fonts folder. What should I do?
我得到的错误是:
invalid resource directory name fonts /NoRats/assets line 1 Android AAPT Problem
推荐答案
请查看这个链接,它可能对你有帮助.
Please check this link, it may be helpful to you.
或
使用下面的代码.
Typeface tf = Typeface.createFromAsset(this.getAssets(),"fonts/LATINWD.TTF");
txt1.setTypeface(tf);
.ttf 文件在 --> assets/fonts/LATINWD.TTF
.ttf file is in --> assets/fonts/LATINWD.TTF
请先清理您的项目,然后再检查.
Please first clean your project then check again.
快乐编码.
这篇关于我应该把“ttf"放在哪里?Android项目中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文