如何检索机器人提供/安装的字体列表? [英] How to retrieve a list of available/installed fonts in android?

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

问题描述

在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?

推荐答案

马克·墨菲的回答两者的Andr​​oid开发者邮件列表:

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

<一个href="http://developer.android.com/reference/android/graphics/Typeface.html">http://developer.android.com/reference/android/graphics/Typeface.html

有只有三种字体:正常   (德罗伊德桑),衬线(Droid的衬线),和   等宽(德罗伊德桑单声道)。

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 <一href="https://github.com/mcalliph/roboto-text-view">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

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

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