在Android Studio中自定义字体库报错:java.lang.RuntimeException: native typeface cannot be made

来源:互联网 发布:js radio 取得 编辑:程序博客网 时间:2024/05/21 03:19

1.网上有很多这样的问题,解决的办法有很多,不同的人可能不一样,推荐一个比较详细的解决方案的地方,http://stackoverflow.com/questions/12766930/native-typeface-cannot-be-made-only-for-some-people

自己可以去试试.博主是修改了所建的assets文件的位置后问题得到了解决.

2.代码部分

 private EditText mText; mText = (EditText) findViewById(R.id.text);  // 设置字体test.ttf mText.setTypeface(Typeface.createFromAsset(getAssets(), "fonts/test.ttf")); Caused by: java.lang.RuntimeException: native typeface cannot be made

3.解决的办法:

 将assets文件夹建立在src/main目录结构中.
0 0
原创粉丝点击