Android系统中在Settings->Display->Font Size设置系统字体大小,默认的系统字体大小为Normal

修改默认值

代码路径:/frameworks/base/core/java/android/content/res/Configuration.java
在public void setToDefaults()方法中进行修改,
如果默认要改成特大字体,请改为1.30;

1
2
3
4
public void setToDefaults() {   
fontScale = 1.30; //normal value is 1.0
mcc = mnc = 0;
...

然后重新build framework.jar这个模块即可
注意:Settings中系统的字体大小,在/packages/apps/Settings/res/values/arrays.xml文件中的”entryvalues_font_size”这个tag中分别有定义对应的数值

1
2
3
4
Small:0.85   
Normal:1.0
Large:1.15
Huge:1.30

添加一个选项值

代码路径:/packages/apps/Settings/res/values/arrays.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<string-array name="entries_font_size">
<item msgid="6490061470416867723">Small</item>
<item msgid="3579015730662088893">Normal</item>
<item msgid="1678068858001018666">Large</item>
<item msgid="490158884605093126">Huge</item>
<item msgid="945212277880982567">Very Huge</item> //添加一个选项值
</string-array>

<string-array name="entryvalues_font_size" translatable="false">
<item>0.85</item>
<item>1.0</item>
<item>1.15</item>
<item>1.30</item>
<item>2.0</item> //添加一个选项值
</string-array>