开发者

What are the default font characteristics in Android ?

开发者 https://www.devze.com 2023-01-27 06:18 出处:网络
I know that fonts properti开发者_高级运维es can be found in the TypeFace class but I can\'t find the default characteristics of the writing in Android. I mean, if I take a TextView and simply do setTe

I know that fonts properti开发者_高级运维es can be found in the TypeFace class but I can't find the default characteristics of the writing in Android. I mean, if I take a TextView and simply do setText("Blabla") on it, what will I get? Which size in px? Which font? etc.


You can check the default style of the widgets here: android/res/values/styles.xml

Then, looking for Textview you reach

  <style name="Widget.TextView">    
     <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>    
 </style>

and after researching a little bit, you find out that this appearance is defined in the same styles.xml file

<style name="TextAppearance.Small">    
 <item name="android:textSize">14sp</item>    
 <item name="android:textStyle">normal</item>    
 <item name="android:textColor">?textColorSecondary</item>    
</style>

where

<item name="textColorSecondary">@android:color/secondary_text_dark</item>

these colors are defined in /res/color/, check /res/color/secondary_text_dark.xml

Bookmarking the android/res/values folder is a must!

Update: my old links are broken, check Android core resources folder on Github. Thanks to kreker for the link.


For the newer 4.0 ICS etc there's the Android design pages which shows a list of font sizes:

http://developer.android.com/design/style/typography.html

All specified as 'sp' units

HTH

0

精彩评论

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