且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Android应用程序更改字体的应用程序崩溃 - 本地字体不能发

更新时间:2023-01-27 12:36:09

您的资产创建名为字体的文件夹或直接放置在资产文件夹?如果文件夹中没有创建创建一个文件夹,把你的字体文件,还有我认为这是mistake..In你的榜样,他是不会创建任何字体文件夹,他被直接访问,但你是从字体文件夹访问。

Are you created a folder called fonts in assets or directly placed in assets folder??if folder not created create a folder and place your font file there I think that is the mistake..In your example he is not created any fonts folder he is directly accessing but you are accessing from fonts folder..

如果不是字体文件夹,然后更改此行。

If not fonts folder then change this line to.

Typeface font = Typeface.createFromAsset(getAssets(), "fonts/amal.TTF");

这样的..

like this..

Typeface font = Typeface.createFromAsset(getAssets(), "amal.TTF");