在源碼\android\frameworks\base\core\java\android\content\res\Configuration.java下有讀取DEFAULT_FONTSCALE的值,若是沒有定義這個值就用缺省的值fontScale = 1.0f;java
代碼以下:android
/** * Set this object to the system defaults. */ public void setToDefaults() { String scale = Build.DEFAULT_FONTSCALE; if ( scale.equalsIgnoreCase( Build.UNKNOWN ) == false ) { fontScale = Float.valueOf( Build.DEFAULT_FONTSCALE ).floatValue(); } else { fontScale = 0.85f;//add by wangjian 2014.01.16 //fontScale = 1.0f;//default value } mcc = mnc = 0; locale = null;
我後來加的代碼:shell
fontScale = 0.85f;
這個值app
Build.DEFAULT_FONTSCALE
在android\frameworks\base\core\java\android\os\Build.java中有定義:ui
/**a property to tablet systemUI */ public static final String TABLETUI = getString("ro.property.tabletUI"); /**a property to tablet systemUI */ public static final String DEFAULT_FONTSCALE = getString("ro.property.fontScale");
而這個設置:this
ro.property.fontScale
是在\android\device\softwinner\wing-k70\wing_k70.mk中定義,代碼以下:code
# ui PRODUCT_PROPERTY_OVERRIDES += \ ro.property.tabletUI=false \ ro.sf.lcd_density=160 \ ro.property.fontScale=0.85
而源碼裏提供可供選擇的值在代碼android\packages\apps\Settings\res\values\arrays.xml中:xml
<string-array name="entryvalues_font_size" translatable="false"> <item>0.85</item> <item>1.0</item> <item>1.15</item> <item>1.30</item> </string-array>