blob: c375631514d3775e808e709e7773dc1e2e1082ee [file] [log] [blame]
Roman Nurikb99ae732012-03-06 12:26:15 -08001page.title=Metrics and Grids
Scott Main64d51032013-04-12 14:00:30 -07002page.tags="layout","screens"
Roman Nurikb99ae732012-03-06 12:26:15 -08003@jd:body
4
5<p>Devices vary not only in physical size, but also in screen density (<acronym title="Dots per
6inch">DPI</acronym>). To simplify the way you design for multiple screens, think of each device as
Scott Main65b2f3e2013-06-03 12:39:06 -07007falling into a particular size bucket and density bucket:</p>
8<ul>
9 <li>The size buckets are <em>handset</em> (smaller than
10600<acronym title="Density-independent pixels: One dp is one pixel on a 160 dpi (mdpi)
11screen.">dp</acronym>) and <em>tablet</em> (larger than or equal 600dp).</li>
12 <li>The density buckets are <acronym
Roman Nurikb99ae732012-03-06 12:26:15 -080013title="Low density (120 dpi)">LDPI</acronym>, <acronym title="Medium density (160
Scott Main65b2f3e2013-06-03 12:39:06 -070014dpi)">MDPI</acronym>, <acronym title="High density (240 dpi)">HDPI</acronym>, <acronym title
Dirk Dougherty0b734032013-10-19 11:43:41 -070015="Extra-high density (320 dpi)">XHDPI</acronym>, <acronym title
16="Extra-extra!-high density (480 dpi)">XXHDPI</acronym>, and <acronym title
17="Extra-extra-extra!-high density (640 dpi)">XXXHDPI</acronym>.</li>
Scott Main65b2f3e2013-06-03 12:39:06 -070018</ul>
19
20<p>Optimize your application's UI by designing
Roman Nurikb99ae732012-03-06 12:26:15 -080021alternative layouts for some of the different size buckets, and provide alternative bitmap images
22for different density buckets.</p>
23
Scott Main65b2f3e2013-06-03 12:39:06 -070024<p>Because it's important that you design and implement your layouts for multiple densities,
25the guidelines below and throught the documentation
26refer to layout dimensions with <acronym title="Density-independent pixels: One dp is one pixel
27on a 160 dpi (mdpi) screen.">dp</acronym> measurements instead of pixels.</p>
28
29
Roman Nurikb99ae732012-03-06 12:26:15 -080030<div class="layout-content-row">
31 <div class="layout-content-col span-8">
32
33 <img src="{@docRoot}design/media/metrics_diagram.png">
34
35 </div>
36 <div class="layout-content-col span-5">
37
38<h4>Space considerations</h4>
39<p>Devices vary in the amount of density-independent pixels (dp) they can display.</p>
40<p>To see more, visit the
41<a href="http://developer.android.com/resources/dashboard/screens.html" target="_blank">
42Screen Sizes and Densities Device Dashboard</a>.</p>
43
44 </div>
45</div>
46
Scott Main65b2f3e2013-06-03 12:39:06 -070047
Roman Nurikb99ae732012-03-06 12:26:15 -080048<h2 id="48dp-rhythm">48dp Rhythm</h2>
49
50<p>Touchable UI components are generally laid out along 48dp units.</p>
51
52<img src="{@docRoot}design/media/metrics_48.png">
53
54<div class="vspace size-2">&nbsp;</div>
55
56<h4>Why 48dp?</h4>
57<p>On average, 48dp translate to a physical size of about 9mm (with some variability). This is
58comfortably in the range of recommended target sizes (7-10 mm) for touchscreen objects and users
59will be able to reliably and accurately target them with their fingers.</p>
60<p>If you design your elements to be at least 48dp high and wide you can guarantee that:</p>
61<ul>
62<li>your targets will never be smaller than the minimum recommended target size of 7mm regardless of
63 what screen they are displayed on.</li>
64<li>you strike a good compromise between overall information density on the one hand, and
65 targetability of UI elements on the other.</li>
66</ul>
67
68<img src="{@docRoot}design/media/metrics_closeup.png">
69
70<div class="vspace size-2">&nbsp;</div>
71
72<h4>Mind the gaps</h4>
73<p>Spacing between each UI element is 8dp.</p>
74
75<h2 id="examples">Examples</h2>
76
77<img src="{@docRoot}design/media/metrics_forms.png">