Skip to content
Material Design 1
Main Navigation
v3
v2
v1

English

简体中文
繁體中文
Español
Français
Русский
Português – Brasil
Deutsch
日本語
한국어
Italiano
Polski
Türkçe
čeština
magyar

English

简体中文
繁體中文
Español
Français
Русский
Português – Brasil
Deutsch
日本語
한국어
Italiano
Polski
Türkçe
čeština
magyar

Appearance

Sidebar Navigation

Material Design

Environment

Material properties

Elevation & shadows

What's new

Motion

Material motion

Duration & easing

Movement

Transforming material

Choreography

Creative customization

Style

Color

Icons

Imagery

Typography

Writing

Layout

Principles

Units & measurements

Metrics & keylines

Structure

Responsive UI

Split screen

Components

Bottom navigation

Bottom sheets

Buttons

Buttons: Floating Action Button

Cards

Chips

Data tables

Dialogs

Dividers

Expansion panels

Grid lists

Lists

Lists: Controls

Menus

Pickers

Progress & activity

Selection controls

Sliders

Snackbars & toasts

Steppers

Subheaders

Tabs

Text fields

Toolbars

Tooltips

Widgets

Patterns

Confirmation & acknowledgement

Data formats

Empty states

Errors

Fingerprint

Gestures

Help & feedback

Launch screens

Loading images

Navigation

Navigation drawer

Navigational transitions

Notifications

Offline states

Permissions

Scrolling techniques

Search

Selection

Settings

Swipe to refresh

Growth & communications

Introduction

Onboarding

Feature discovery

Gesture education

Usability

Accessibility

Bidirectionality

Platforms

Platform adaptation

Android

Resources

Color palettes

Devices

Layout templates

Roboto & Noto fonts

Sticker sheets & icons

Shadows

On this page

Units & measurements ​

Some units have different meanings in different contexts. This chapter discusses the usage of density-independent pixels, scalable pixels, as well as concepts like pixel density.

Pixel density ​

The number of pixels that fit into an inch is referred to as “pixel density.” High-density screens have more pixels per inch than low-density ones. As a result, UI elements (such as a button) appear physically larger on low-density screens and smaller on high-density screens.

Screen resolution refers to the total number of pixels in a display.

screen density = screen width (or height) in pixels / screen width (or height) in inches


Related: Supporting Multiple Screens Optimize your design for different screen densities.

Related: More Resource Types Units of measure supported by Android.


High-density screen with Material Design
High-density screen
Low-density screen with Material Design
Low-density screen

Density-independent pixels (dp) ​

"Density independence" refers to the uniform display of UI elements on screens with different densities.

Density-independent pixels (pronounced “dips”) are flexible units that scale to uniform dimensions on any screen. When developing an Android application, use dp to display elements uniformly on screens with different densities.

Material Design density-independent pixels (dp)

A dp is equal to one physical pixel on a screen with a density of 160. To calculate dp:

dp = (width in pixels * 160) / screen density

When writing CSS, use px wherever dp or sp is stated. Dp only needs to be used in developing for Android.

Screen densityScreen width in pixelsScreen width in density-independent pixels
120180 px240 dp
160240 px
240360 px

If you have three screens, all 1.5 inches wide, with varying screen densities, the screen width will still be 240dp for all of them.

Scalable pixels (sp) ​

When developing for Android, scalable pixels (sp) serve the same function as dp, but for fonts. The default value of an sp is the same as the default value for dp.

The primary difference between an sp and a dp is that sp preserves a user's font settings. Users who have larger text settings for accessibility will see the font size matched to their text size preferences.

Designing layouts for dp ​

When designing layouts for the screen, calculate an element’s measurements in dp:

dp = (width in pixels * 160) / density

For example, a 32 x 32 px icon with a screen density of 320 equals 16 x 16 dp.

Image scaling ​

Images can be scaled to look the same across different screen resolutions by using these ratios:

Screen resolutiondpiPixel ratioImage size (pixels)
xxxhdpi6404.0400 x 400
xxhdpi4803.0300 x 300
xhdpi3202.0200 x 200
hdpi2401.5150 x 150
mdpi1601.0100 x 100
Pager
Previous pagePrinciples
Next pageMetrics & keylines

Released under the Apache-2.0

Copyright © 2014-Present Google

https://m1.material.io/layout/units-measurements.html

Released under the Apache-2.0

Copyright © 2014-Present Google