android中的fontFamily和typeFace有什么区别? [英] What is the difference between fontFamily and typeFace in android?
问题描述
在Android中,fontFamily和typeFace有什么区别?当然,我已经在android开发人员网站上阅读了所有说明,但还不清楚.
What is the difference between fontFamily and typeFace in android ? Of course, I read all the description in android developer site, but I'm not clear yet.
根据两个词的一般含义,它应该具有相同的含义.但是在android xml属性(textview ...)中,它同时具有这两个属性.这让我很困惑.
According to the general meaning of two words, it should be same meaning. But in the android xml properties(textview...), it has both properties. That makes me very confused.
据我所知...fontFamily和typeFace是一组外观相同的字体.(Roboto,Arial)字体是fontFamily的特定字体.(Roboto-18pt-Bold,Arial-10pt-Italic)
As far as I know.... fontFamily and typeFace is a group of same-look of fonts.(Roboto, Arial) Font is a specific one of fontFamily.(Roboto-18pt-Bold, Arial-10pt-Italic)
我想念什么?
推荐答案
要找到问题的答案,您必须查看TextView的源代码,您可以在此处找到其实现
To find the answer of your question you have to look into the source code of TextView, you will find its implementation here
现在从方法 setTypefaceFromAttrs()
的实现开始,如果设置了 fontFamily
属性,则 typeface
属性将被忽略.
Now from the implementation of method setTypefaceFromAttrs()
it seems like, If you have set fontFamily
attribute then typeface
attribute will be ignored.
还在 api级别1 中添加了 android:typeface
属性,使用该属性,您可以设置以下字体
Also android:typeface
attribute is added in api level 1 and using this you can set following fonts
- normal
- serif
- sans
- monospace
在 api级别16 中添加了 android:fontFamily
属性,该属性支持来自roboto字体家族的更多字体,例如-
Whereas android:fontFamily
attribute is added in api level 16 and this supports more fonts from roboto font family like -
- serif
- monospace
- sans-serif
- sans-serif-condensed
- serif-monospace
- sans-serif-smallcaps
有关更多信息,请使用下面的链接
For more information use below link
这篇关于android中的fontFamily和typeFace有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!