Android4.1 modify default font size

Source: Internet
Author: User

I. Frameworks/base/CORE/Java/Android/content/RES/configuration. Java:
The public void settodefaults () method is modified,
If you want to change the font to a mega font by default, change it to 1.15f.
Public void settodefaults (){
Fontscale = 1.15f; // normal value is 1

MCC = MNC = 0;

Ii. Packages \ apps \ Settings \ res \ values \ arrays. xml:

<String-array name = "entryvalues_font_size" translatable = "false">
<Item> 0.85 </item>
<Item> 1.15 </item>
<Item> 1.20 </item>
<Item> 1.30 </item>
</String-array>

Note: After you modify the default font, change the settings to the corresponding one.

Later, we thought we could use the property to control the default font size, which made it much easier to modify.

I. Frameworks/base/CORE/Java/Android/content/RES/configuration. Java:

Import Android. OS. Build;

Public void settodefaults (){
String scale = build. default_fontscale;
If (scale. Assign signorecase (build. Unknown) = false)
{
Fontscale = float. valueof (build. default_fontscale). floatvalue ();
}
Else
{
Fontscale = 1.0f;
}

Ii. Frameworks \ base \ core \ Java \ Android \ OS \ build. Java

/** A property to set fontscale */
Public static final string default_fontscale = getstring ("Ro. Property. fontscale ");

3: You can set the default font size through system attributes.

Note: Make Update-API must be executed before compilation.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.