Android multiple screen sizes with same density

后端 未结 6 838
你的背包
你的背包 2020-11-29 16:49

I\'m confused regarding the densities. I see that with medium density, the screen resolution could be either 320x480, 480x800, or 480x854. So if I have an image thats 300px

6条回答
  •  盖世英雄少女心
    2020-11-29 17:30

    Could you please confirm the formula for calculating the screen density?

    As I have read, the following is the formula:

    Density = SQRT (wp^2 + hp^2)/screen size

    wp -> width of the screen (in px) hp -> height of the screen (in px) screen size -> Physical screen size (diagonal inches)

    screen size (320x480) = SQRT(102400 + 230400) /160 = 3.6 inches

    screen size (480x800) = SQRT(640000 + 230400) /160 = 5.8 inches

    screen size (480x854) = SQRT(729316 + 230400) /160 = 6.12 inches

    So, the layouts (UI screens) are driven by screen sizes (small: <3", normal <4", large >5") and drawable resources (images) are driven by screen densities.

    And, the size of the image (in pixels) does not change if the density of the screens (320x480, 480x800, or 480x854) are the same.

    Could you please confirm?

    Thanks, Ram

提交回复
热议问题