My Life with Android
Introduction Android Componets UserInterface Advanced UI Data Storage Advanced Concepts Others New Studio

Supporting Multiple Screens

Android runs on a variety of devices that offer different screen sizes and densities. Although the system performs scaling and resizing to make your application work on different screens, you should make the effort to optimize your application for different screen sizes and densities. In doing so, you maximize the user experience for all devices and your users believe that your application was actually designed for their devices -rather than simply stretched to fit the screen on their devices.

Terms and concepts

1. Screen size

Actual physical size, measured as the screen's diagonal.
For simplicity, Android groups all actual screen sizes into four generalized sizes: small, normal, large, and extra-large.

2. Screen density

The quantity of pixels within a physical area of the screen; usually referred to as dpi (dots per inch). For example, a "low" density screen has fewer pixels within a given physical area, compared to a "normal" or "high" density screen. For simplicity, Android groups all actual screen densities into six generalized densities: low, medium, high, extra-high, extra-extra-high, and extra-extra-extra-high.

3. Resolution

The total number of physical pixels on a screen. When adding support for multiple screens, applications do not work directly with resolution; applications should be concerned only with screen size and density, as specified by the generalized size and density groups.

4. Density-independent pixel (dp)

A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way. The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. You should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.
A set of six generalized densities:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi

Supporting different sizes

If you intend on your application being available on a large range of devices, you should place your application icon into the different res/drawable... folders provided.
  • drawable-ldpi (120 dpi, Low density screen) - 36px x 36px
  • drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px
  • drawable-hdpi (240 dpi, High density screen) - 72px x 72px
  • drawable-xhdpi (320 dpi, Extra-high density screen) - 96px x 96px
  • drawable-xxhdpi (480 dpi, Extra-extra-high density screen) - 144px x 144px
  • drawable-xxxhdpi (640 dpi, Extra-extra-extra-high density screen) - 192px x 192px
1. Launcher icons (.Png)

48 X 48 (mdpi)
72 X 72 (hdpi)
96 X 96 (xhdpi)
144 X 144 (xxhdpi)
192 X 192 (xxxhdpi)
512 X 512 (Google Play store)
-----------------------------------------------------------
2. Action bar, Dialog & Tab icons

24 X 24 area in 32 X 32 (mdpi)
36 X 36 area in 48 X 48 (hdpi)
48 X 48 area in 64 X 64 (xhdpi)
72 X 72 area in 96 X 96 (xxhdpi)
96 X 96 area in 128 X 128 (xxxhdpi) 
------------------------------------------------------------
3.  Notification icons

22 X 22 area in 24 X 24 (mdpi)
33 X 33 area in 36 X 36 (hdpi)
44 X 44 area in 48 X 48 (xhdpi)
66 X 66 area in 72 X 72 (xxhdpi)
88 X 88 area in 96 X 96 (xxxhdpi)
-------------------------------------------------------------
4. Small Contextual Icons

16 X 16 (mdpi)
24 X 24 (hdpi)
32 X 32 (xhdpi)
48 X 48 (xxhdpi)
64 X 64 (xxxhdpi)

Result = Value(dpi) * device density(pi)/160(dpi)
For mdpi density = 160, hdpi - 240, xhdpi - 320 , ldpi - 120,

As in your case if value is 10*10 then the Result for different screen will be :
For ldpi:
Result = 10*120/160 = 7.5 , i.e 7 pixels

For mdpi:
Result = 10*160/160 = 10 pixels

For hdpi:
Result = 10*240/160 = 15 pixels

For xhdpi:
Result = 10*320/160 = 20 pixels

Supporting Multiple Screens

Android choose resources from drawable folders according to dpi
There are four screen densities
  1. ldpi
  2. mdpi
  3. hdpi
  4. xhdpi
Four screen sizes
  1. layout-small
  2. layout-nomal
  3. layout-large
  4. layout-xlarge
small screen size = 2.2" - 2.7" (approx)

normal screen size = 3.0" - 4.7" (approx)

large screen size = 5" - 7" (approx)

xlarge screen size = 7"> (approx)

ldpi = 120dpi

mdpi = 160dpi

hdpi 240dpi

xhdpi = 320dpi