java - 在 Android studio 中使用 otf 字体

标签 java android android-studio fonts webfonts

我在 Android studio 中看到很多关于 ttf 字体的引用,但没有一个描述 otf 类型字体的用法。有没有办法在 Android studio 项目中也使用 otf 类型的字体?

最佳答案

始终支持 TTF。 OTF 后来至少在 1.6 及更高版本中添加,但只是部分添加。

Typeface face;

face = Typeface.createFromAsset(getAssets(), "font.otf");

textview.setTypeface(face);

有用的链接:Use external fonts in android

您可以转换此页面:http://www.ehow.com/how_6192479_convert-dfont-ttf.html , https://onlinefontconverter.com/

关于java - 在 Android studio 中使用 otf 字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37301876/

相关文章:

java - org/apache/cxf/jaxb/JAXBToStringStyle 上的 NoClassDefFoundError

java - 获取Android唯一标识

android - 使用 arrayadapter 过滤 ListView

在数据库中找不到 Android SQLite 外键列

java - 如何调试这段代码以了解它在做什么?

java - 线程 "main"org.openqa.selenium.ElementNotInteractableException : element not interactable 中出现异常

java - 由于存在或不存在 System.out.println() 语句,递增 int 变量的结果会有所不同

android - Flutter 中任务 ':app:stripDebugDebugSymbols' 执行失败

java - 无法获取要从数据库重新加载的列表项

android - 如何将XML中的字符串数组和整数数组添加到一个集合中