Android Units of Measurements

Today we well discuss about Android units of measurements like: px, in, mm, dp, dip and sp …

1. What is Pixel – px:

Pixel, PX, or even called pel (derived from “picture element”), we usually called pixels, is square.

An image bitmap that you see on screen is two-dimensional matrix (2D) of pixels make up (or matrix of small squares). Each pixel occupies one position in the matrix and contains one part of the picture display. Each pixel contains only one color combination from 3 primary colors Red, Green, Blue.

Android Units of Measurements 1

Pixel is often used to talk about the resolution (resolution) of the device.

For example: Samsung Galaxy S3 screen resolution of 1280 × 720 (Height x Width). This means that the height of the screen is 1280 pixels Galaxy S3, and the width is 720 pixels.

Devices with higher resolution screens are more and more pixels. However this is not to say that the screen will show you beautiful images. This depends on the area of the screen, so the pixel is not used as a unit of measurement of the screen size the device, but it is used to measure the size of the image.

2. Dp, or dip or Density-independent Pixels, sometimes called Device-independent Pixels:

This is a measure of the physical length, like inches, cm, mm … but Google often used to measure the size of the device screen. (The iOS user have point pt or similar concept with dp).

160 dp = 1 inch – this means = 1/160 = 0.00625 inch 1dp.

1 dp may contain one or more pixels.

Android Units of Measurements 2

As the example image above 10dp in low resolution screen equivalent 1dp 1 pixel. On average, the resolution equivalent 1dp 4 pixels …

3. DPI – Dots per inch, or ppi – Pixels per inch:

Note that dp or dip should not be confused with the dpi (dots per inch).

Dots per inch is the number of pixels (pixels) on 1 inch of display devices, this number the larger the display screen equipment as smooth and beautiful photos.

Based on one divided dpi screen type as follows:

– Small: ldpi (120dpi)

– Normal: mdpi (160dpi)

– Large: HDPI (240dpi)

– X-large: xhdpi (320dpi).

With this type 1 dp each corresponding to the number of different pixels, is calculated using the formula:

PX = dp * (dpi / 160)

For example the device is 320 dpi with 10-dp then we get: 10 * (320/160) = 20 PX, 1 or 2 PX dp.

 
ModelScreen Size InchScreen Size CmsResolution PixelsPixel Density PPi
Samsung Galaxy S65.112.951440 x 2560571
LG G35.513.971440 x 2560534
Samsung Galaxy Note 45.714.481440×2560515
Nexus-65.9615.142560 x 1440493
HTC One M8512.71080 x 1920441
Samsung Galaxy S55.112.951080×1920432
Sony Xperia Z35.213.211080×1920424
Moto X5.213.211080×1920424
iPhone-6 Plus5.513.971080 x 1920401
Lumia 1520615.241080 x 1920367
iPhone-64.711.94750 x 1334326

4. PT – Point:

PT – which stands for Point, concept similar dp pt is a unit measuring the actual size, but differ with dp:

1 pt = 1/72 inch, while 1 dp = 1/160 inch

pt often used in iOS programming.

5. SP – Scale-independent Pixels:

Similar to dp, but sp commonly used for the text font size.

Android Units of Measurements 3

The following are examples of normal screen display mdpi (160dpi) for the unit of measurement dp, sp, PX, pt, inch.

Android Units of Measurements 4

Add Comment