App font size does not change with system changes

Source: Internet
Author: User

Reprint Please specify source: http://www.cnblogs.com/cnwutianhao/p/6713724.html

In "Settings", "Show", "Font size" We can set the system font size

The app interface font, if modified, may not achieve the desired effect, the interface layout has changed.

Unmodified effect (Test model: Nexus 5):

Normal small Super big

Effect after modification (test model: Nexus 5):

Normal small Super big

From these two sets of comparison charts, we can visually see that the modified app font size does not change with the system changes.

In fact, it is easy to implement, without having to set the "TextSize" in the layout file, simply rewrite the Getresources () method in the parent activity:

@Override      Public Resources getresources () {        super. getresources ();         New Configuration ();        Configuration.settodefaults ();        Resources.updateconfiguration (Configuration, Resources.getdisplaymetrics ());         return resources;    }

Follow me on Sina Weibo for more information on Android development!
Focus on technology critics, learn about technology, innovation, education and maximizing human intelligence and imagination!

App font size does not change with system changes

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.