Android系统移植与调试之------->如何修改Android默认字体大小和设置里面字体大小比例

           因为我修改 ro.sf.lcd_density的值,将它从160修改 为120,所以导致整个系统的字体都变得很小。因此需要将整个字体变大,并且在设置-->显示-->字体大小的4个选项的值都必须变大。我想到的思路是将字体的缩放比例调大一些,下面是我的修改步骤。

1、修改默认字体的大小

Step1: 修改frameworks/base/core/java/android/content/res/Configuration.java  

文件中的setToDefaults()方法,将默认的字体缩放比例调为1.35f,即修改fontScale属性

Public void setToDefaults(){
 fontScale=1.35f; //default value is 1
mcc = mnc = 0;
....
}




2、修改设置-->显示-->字体大小的4个选项值

Step2:  vim packages/apps/Settings/res/values/arrays.xml和

vim packages/apps/Settings/res/values-sw600dp/arrays.xml

下面就是4个选项对应的值,分别为 小、正常、大、超大

<pre class="html" name="code"><string-array name=”entryvalues_font_size” translatable=”false”>
<item>1.4</item>
<item>1.45</item>
<item>1.5</item>
<item>1.55</item>
</string-array>





Step3: 编译frameworks模块

./mk mbk77_twn_cu_jb mm frameworks/


Step4: 编译packages模块

./mk mbk77_twn_cu_jb mm packages/

Step5: 更新systemimage

./mk mbk77_twn_cu_jb systemimage


Step6:  将生成的文件copy到指定目录(Getimag.sh是个批处理文件,用来copy文件的,读者可以自己写)

./Getimag.sh 


Getimag.sh代码如下

#!/bin/sh

for project in "$@"
do
echo "客户名称 = $project"
done

project="mbk77_twn_cu_jb"
#echo "cust project is:" $project

rm -rf out/bin
mkdir out/bin

cp -rf out/target/product/$project/boot.img out/bin/
cp -rf out/target/product/$project/cache.img out/bin/
cp -rf out/target/product/$project/DSP_BL out/bin/
cp -rf out/target/product/$project/kernel out/bin/
cp -rf out/target/product/$project/ramdisk.img out/bin/
cp -rf out/target/product/$project/ramdisk-recovery.img out/bin/
cp -rf out/target/product/$project/recovery.img out/bin/
cp -rf out/target/product/$project/secro.img out/bin/
cp -rf out/target/product/$project/system.img out/bin/
cp -rf out/target/product/$project/userdata.img out/bin/
cp -rf mediatek/misc/EBR1 out/bin/
#cp -rf mediatek/source/misc/EBR2 out/bin/
cp -rf mediatek/misc/MBR out/bin/
cp -rf mediatek/misc/*MT6577_Android_scatter_emmc.txt out/bin/
cp -rf kernel/out/kernel_$project.bin out/bin/
cp -rf bootable/bootloader/lk/build-$project/logo.bin out/bin/
cp -rf mediatek/preloader/preloader_$project.bin out/bin/
cp -rf bootable/bootloader/lk/build-$project/lk.bin out/bin/
cp -rf mediatek/cgen/APDB_MT6577_S01_MAIN2.1_W10.24_ENUM out/bin/
cp -rf mediatek/cgen/APDB_MT6577_S01_MAIN2.1_W10.24 out/bin/
cp -rf mediatek/custom/common/modem/keytak15_atv_gb2_gprs/BPLGUInfoCustomApp_MT6577_S00_MAUI_11AMD_W12_22_SP_V27 out/bin/
cd out/bin/
zip -r $project.zip *
mv $project.zip ../
echo "操作完成"



 

step7: 捎入Android设备查看效果



==================================================================================================

  作者:欧阳鹏  欢迎转载,与人分享是进步的源泉!

  转载请保留原文地址http://blog.csdn.net/ouyang_peng

==================================================================================================


上一篇:找一门静态类型的脚本语言用用看怎么样


下一篇:JVM 学习笔记