Difficulty to understand how to support multiple screen

前端 未结 4 598
Happy的楠姐
Happy的楠姐 2021-02-06 18:06

I have seen so many questions on StackOverFlow how to support multiple screens. But most of the answers provide this link and this. And in the first one link I have

4条回答
  •  礼貌的吻别
    2021-02-06 18:26

    From Android: Supporting Multiple Screens

    px = dp * (dpi / 160)

    Illustration of how Android roughly maps actual sizes and densities to generalized sizes and densities (figures are not exact)


    So for your example:

    Your image dimensions are 960dp x 720dp and your dpi is 320 (which you can see falls under XHDPI).

    Height = 960dp * (320 / 160) = 1920px
    
    Width = 720dp * (320 / 160) = 1440px
    

    Height and width are arbitrary depending on the orientation of the phone

提交回复
热议问题