2017-06-16 59 views

回答

1

有关屏幕尺寸,请阅读Android Documentation

根据基本图像大小,通过DPI可绘制大小的缩放比率为3:4:6:8:12:16。

LDPI - 0.75x 
MDPI - Original size // means 1.0x here 
HDPI - 1.5x 
XHDPI - 2.0x 
XXHDPI - 3x 
XXXHDPI - 4.0x 

例如,MDPI上的100x100px图像与XHDPI屏幕上的200x200px大小相同。

你可以看到这里不同resolations不同尺寸:

xlarge screens are at least 960dp x 720dp 
large screens are at least 640dp x 480dp 
normal screens are at least 470dp x 320dp 
small screens are at least 426dp x 320dp 
Generalised Dpi values for screens: 

ldpi Resources for low-density (ldpi) screens (~120dpi) 
mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.) 
hdpi Resources for high-density (hdpi) screens (~240dpi). 
xhdpi Resources for extra high-density (xhdpi) screens (~320dpi). 
Therefore generalised size of your resources (assuming they are full screen): 

ldpi 
Vertical = 426 * 120/160 = 319.5px 
Horizontal = 320 * 120/160 = 240px 
mdpi 
Vertical = 470 * 160/160 = 470px 
Horizontal = 320 * 160/160 = 320px 
hdpi 
Vertical = 640 * 240/160 = 960px 
Horizontal = 480 * 240/160 = 720px 
xhdpi 
Vertical = 960 * 320/160 = 1920px 
Horizontal = 720 * 320/160 = 1440px 

px = dp*dpi/160 
+0

有什么样的应用? –

+0

@AliAshraf我不知道你是什么意思示例应用程序,但所有的Android标准应用程序使用这种方法。 –

+0

示例应用程序的意思是有任何开源应用程序可用于开发人员的实际知识,但无论如何感谢您的快速和相当大的答案。 –