不同的字体大小不同的屏幕大小不同、字体大小、屏幕、大小

2023-09-04 03:11:08 作者:眸笑意深浓

在我的应用程序必须使用一个较小的字体为中密度设备。是否可以指定?

In my application I must use a smaller font for the medium density devices. Is it possible to specify that?

推荐答案

您应该使用风格,那么你可以有单独的文件夹值(默认)值 - 华电国际(高密度)的价值观,MDPI(中密度)等,并根据需要把你的样式文件与正确的TEXTSIZE值的每个文件夹中。

You should use styles, then you can have separate folders "values" (default) "values-hdpi" (high density) "values-mdpi" (medium density) and so on and put your style file with correct textSize values in each folder as needed.

然后,当你在中密度装置将是否存在或值中,如果不挑的价值观,MDPI文件夹中的文件,且同为高密度等...

Then, when you are in medium density device it will pick the file in "values-mdpi" folder if exists or in "values" if not, and the same for high density etc...

这个原则同样适用于人的资源的子文件夹(可绘制值,等...)

This same principle applies to al "res" subfolders (drawables, values, etc...)