如何在android中检索可用/已安装字体的列表? [英] How to retrieve a list of available/installed fonts in android?

查看:34
本文介绍了如何在android中检索可用/已安装字体的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Java 中,我会做类似的事情:

In Java I would do something like:

java.awt.GraphicsEnvironment ge = 
                      java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
Font[] fonts = ge.getAllFonts(); 

是否有 Android 等价物?

is there an Android equivalent?

推荐答案

摘自 Mark Murphy 在 Android Developers 邮件列表上的回答:

Taken from Mark Murphy's answer on the Android Developers mailing list:

http://developer.android.com/reference/android/graphics/字体.html

只有三种字体:普通(Droid Sans)、衬线 (Droid Serif) 和等宽(Droid Sans Mono).

There are only three fonts: normal (Droid Sans), serif (Droid Serif), and monospace (Droid Sans Mono).

虽然可能有其他字体埋在 WebKit 的某个地方,他们似乎无法访问WebKit 之外的开发人员.:-(

While there may be additional fonts buried in WebKit somewhere, they appear to be inaccessible to developers outside of WebKit. :-(

唯一的其他字体是您与应用程序捆绑在一起的任何 TrueType 字体.

The only other fonts are any TrueType ones you bundle with your application.

Roboto 是 Android 4.0 中的一种新字体.您可以使用这个库项目在所有版本中使用它回到 API 级别 4 https://github.com/mcalliph/roboto-text-view

Roboto is a new font which came in with Android 4.0. You can use this library project to use it in all versions back to API level 4 https://github.com/mcalliph/roboto-text-view

这篇关于如何在android中检索可用/已安装字体的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆