E/Minikin(32505): addFont failed to create font

来源:互联网 发布:阿里云服务器登陆账号 编辑:程序博客网 时间:2024/06/07 09:30

               

android使用艺术字体

                String  ff=SharedPreferencesUtil.getfont();//选中的字体

// String FilePath=Environment.getExternalStorageDirectory()+"/fonts/889.ttf";
String FilePath =Environment.getExternalStorageDirectory()+"/fonts/"+ff;
Typeface face1;
if(!ff.equals("")) //验证文件是否存在
{

face1 = Typeface.createFromFile(FilePath);
tv.setTypeface (face1);
}else{
tv.setTypeface (MyApplication.face);//默认字体

}

     出现这样异常:W/System.err(8433): java.lang.RuntimeException: Font not found /storage/emulated/0/fonts/84d73c2aa2ea40aab1dc2445fa15255c.ttf

   网上找了好多资料没有解决办法。

  后面将84d73c2aa2ea40aab1dc2445fa15255c.ttf 名字改成889.ff就可以解决问题。猜可能是名字太长的原因吧。