开发者

Does Typeface.createFromAsset() cache?

Simple question: Does Typeface.createFromAsset() cache? Or should I just keep a reference around in memory to keep handy? The reason why I ask is because I use it quite a 开发者_如何学JAVAlot (all to maintain a single font across many activities / views), so I'm wondering if Typeface will do a simple bit of caching so I don't have to maintain the reference myself.


It doesn't, as best I can tell -- it directly calls down into

http://google.com/codesearch/p?hl=en#uX1GffpyOZk/core/jni/android/graphics/Typeface.cpp&l=115

which looks like it will always open an Asset and create a new typeface for the stream. You can probably double check this yourself; just check and see if you get the same Typeface object from multiple calls to createFromAsset with the same asset.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜