How do I prepare images for all the Android resolutions?

前端 未结 4 751
别跟我提以往
别跟我提以往 2020-12-23 11:43

In iOS preparing graphics is simple. There are either a normal image (height x width) or a retina image which is @2x (2 times height x 2 times width).

However, sin

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-23 12:21

    i got this off of this site a while back, it still comes in handy

    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
    

提交回复
热议问题