gpt4 book ai didi

android - 从字体资源 ID 创建字体

转载 作者:IT老高 更新时间:2023-10-28 22:00:47 27 4
gpt4 key购买 nike

我尝试过使用 Typeface.createFromAsset(getAssets(),"font/myfont.ttf"));

我知道字体目录应该在 Assets 中,但就我而言,我有一个现有的字体资源目录,所以我认为 Assets 管理器将从字体资源目录中读取,但我错了。我正在创建字体来为 collapsingToolbarLayout 设置自定义字体。

我找到了 this answer但它需要我在 Assets 中保留字体

最佳答案

成功了

Typeface typeface = ResourcesCompat.getFont(this, R.font.app_font);

在@Eselfar 的教程链接中找到了这个

关于android - 从字体资源 ID 创建字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48688026/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com