Android的:异常的自定义设置字体 [英] Android: Exception in setting Custom Font

查看:110
本文介绍了Android的:异常的自定义设置字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在打击我的头设置自定义字体,因为一个hour.I已经契税这在我的previous项目和它的工作!从code文本

I have been striking my head with setting up custom fonts to text from code since one hour.I already deed this in my previous project and it worked!

但我不知道什么原因,它给了我厚望的本地字体不能言已这儿过得通过许多问题上了SO与此相关的,并试图解决方案和建议工作了那些cases.But他们没有为我工作。 (

But I don't know for what reason,it gives me expection "native typeface cannot be made" here.I have gone through many questions on SO related to this,and tried solution suggested and worked for those cases.But none of them works for me. :(

我已删除并重新入资产价值的文件夹和我也有与其他font.ttf文件按有关同一issues.I清洗也对这个问题的答案尝试和rebuilded该项目,但一切努力都是徒劳的!

I have deleted and recreated assests folder and also i have tried with other font.ttf file as per the answers on the question related to same issues.I also cleaned and rebuilded the project but every effort was in vain!

请帮助我!我会在你们的帮助表示感谢。

Please help me!! I will be grateful for your help.

$ C C I用于设置字体:

Code i use to set fonts:

我有我的字体文件夹资产GOTHIC.TTF:

I have my fonts GOTHIC.TTF in assets folder:

...
Typeface font=Typeface.createFromAsset(getAssets(), "fonts/GOTHIC.TTF");
title.setTypeface(font);
...

编辑:

我想,我是写误认字型/ GOTHIC.TTF里,因为我已经在资产,而不是在资产直接粘贴字体/ fonts.But使其GOTHIC.TTF也没有解决issue.Where我可能是错的?!

I think,I was mistaking by writing "fonts/GOTHIC.TTF" where as i have pasted fonts directly in assets and not in assets/fonts.But making it "GOTHIC.TTF" also does not solve the issue.Where can I be wrong?!

推荐答案

我不知道究竟是什么所有我尝试了工作,但我得到了它的工作! :)

I don't know what exactly worked from all I tried for but I got it working! :)

所有我试过了,关闭Eclipse和immulator.Re打开该项目,清洁一样,然后我的固定项目的其他错误导致我的工作之一。

All I tried was,closing eclipse and immulator.Re-opening the project,cleaning the same and then fixing other bug of my project resulted me the working one.

感谢所有帮助家伙!

这篇关于Android的:异常的自定义设置字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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