我知道字体属性可以在Typeface
类中找到,但是我找不到Android中写作的默认特征。我的意思是,如果我拿一个TextView
,并简单地对其进行 setText("Blabla")
操作,我会得到什么?哪个大小以像素为单位?使用了哪种字体?等等。
<style name="Widget.TextView">
<item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
</style>
研究后,你发现这个外观是在同一个styles.xml文件中定义的。
<style name="TextAppearance.Small">
<item name="android:textSize">14sp</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">?textColorSecondary</item>
</style>
所在之处
<item name="textColorSecondary">@android:color/secondary_text_dark</item>
这些颜色在 /res/color/ 中定义,查看 /res/color/secondary_text_dark.xml
将android/res/values 文件夹添加书签是必须的!
更新:我的旧链接已经失效,请查看 Github 上的Android core resources folder 。感谢 kreker 提供的链接。
对于较新的4.0 ICS等版本,有Android设计页面显示字体大小列表:
http://developer.android.com/design/style/typography.html
所有指定为“sp”单位
希望对你有所帮助