Android different drawable screen resolutions

浪尽此生 提交于 2019-11-30 08:48:12

This is android's guidelines for icons. Obviously not all drawables are icons, but maybe this helps you get started.

  • 36x36 for low-density
  • 48x48 for medium-density
  • 72x72 for high-density
  • 96x96 for extra high-density

From here: http://developer.android.com/guide/practices/screens_support.html

According to android documentation here

http://developer.android.com/guide/practices/screens_support.html#range

In mdpi (baseline density) 1px = 1dp

and under topic 'Range of screens supported' least resolution for a normal size screen(baseline size) in dp is

470dp X 320dp and since in baseline density 1px = 1dp so baseline screen size in pixels would be

470px X 320px

now for baseline screen size and density 10% of 470px would be 47px and full width is 320px so your baseline drawable will have the following size in pixels

47px X 320px

The scaling ratios for alternative drawables is 3:4:6:8 for ldpi:mdpi:hdpi:xhdpi

this means that the above baseline resolution of your graphic is at scale 4. Now to get resolutions for your graphic in other densities we need to divide the mdpi graphic resolution with 4 to get the unit values

height unit = 47/4 = 11.75

width unit = 320/4 = 80

now reoultions in other densities can be calculated by multiplying unit values with respective scaling ratios

ldpi

11.75 X 3 = 35.25px

80 X 3 = 240px

mdpi (already calculated above, doing it again here for clarity)

11.75 X 4 = 47px

80 X 4 = 320px

hdpi

11.75 X 6 = 70.5px

80 X 6 = 480px

xhdpi

11.75 X 8 = 94px

80 X 8 = 640px

Juned

There are different guidelines on Android developer site about how to manage the image size and resolution to support multiple screens.

Refer this How to develop one android application for different screens?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!