Modify android font and image size with one click.

In the project, you need to dynamically change the fonts and images of the app, find the solution for changing the theme in the review, and a separate method for modifying the font. These two methods are indeed effective, but the implementation is troublesome. In the process of modifying the font, an additional method is found to modify the implementation of the font to change the ratio of sp, so as to guess whether the display density has been modified.  

as well as

Use this method to virtually change the density of the screen and think that the dp unit is generated according to the density of the screen. According to the result, I guess that if it is a 2*2 screen, my picture is 1*1. I tell my activity that my screen is 4*4 at this time, the corresponding pictures and text will become larger, but in fact my screen is still 2*2, but the display effect will become 4*4, that is, the overall picture and font will become larger.

way of implementation

 

If there are any disadvantages, please leave a message

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324919140&siteId=291194637
Recommended