[Android] : Android User Interface Concepts

Richa Sharma
3 min readApr 26, 2021

--

What is Android device screen Size ?

Screen size is physical measured along diagonal.Screen resolution means number of pixels available in the display.

source : Google
  • There are 4 general sizes : Small ,Normal ,Large , Extra Large
  1. Extra Large Screens are at least 960dp x 720dp.
  2. Large Screens are at least 640dp x 480dp.
  3. Normal Screens are at least 470dp x 320dp.
  4. Small Screens are at least 426dp x 320dp.

Android does not currently support screens smaller than this.

  • What is Screen density?

Pixel density is a calculation that returns the number of pixels per inch on a screen or display of a device. dpi-(dots per inch)

  • Few general densities: ldpi, mdpi, hdpi, xhdpi
  1. ldpi-Resources for low-density (ldpi) screens (~120dpi).
  2. mdpi- Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
  3. hpdi- Resources for high-density (hdpi) screens (~240dpi).
  4. xhdpi- Resources for extra-high-density (xhdpi) screens (~320dpi).
  5. xxhdpi-Resources for extra-extra-high-density (xxhdpi) screens (~480dpi)
Source : developer.android

All resources by default are considered for mdpi and scaled by Android for other configuration.

  • What is Screen Orientation?

Screen Orientation, also known as screen rotation, is the attribute of activity element in android. When screen orientation change from one state to other, it is also known as configuration change.

  • Aspect ratio — width/height
  • Aspect ratio is tall : portrait
  • Aspect ratio is wide : landscape
  • What is Screen Resolution ?

Screen Resolution is the number of pixels on a display on screen or in a camera sensor (specifically in a digital image). A higher resolution means more pixels and more pixels provide the ability to display more visual information.

  • Screen Resolution works only with screen size and screen density for cross device support (*** not with screen resolution***).

Android User Interface Measurement Units

  • px (Pixels) — Actual pixels or dots on the screen.
  • in (Inches) — Physical size of the screen in inches.
  • mm (Millimeters) — Physical size of the screen in millimeters.
  • pt (Points) — 1/72 of an inch.
  • dp (Density-independent Pixels) — An abstract unit that is based on the physical density of the screen. These units are relative to a 160 dpi screen, so one dp is one pixel on a 160 dpi screen. The ratio of dp-to-pixel will change with the screen density, but not necessarily in direct proportion. “dip” and “dp” are same.
  • sp (Scale-independent Pixels) — Similar to dp unit, but also scaled by the user’s font size preference.

What is Density Independent pixel?

  • A virtual pixel to define dimensions and position.

System converts dp into px when your app runs.

  • px = dp(dots per inch on your device / 160)
  • This preserves the physical size of you UI.

What is Scaled Pixel?

  • A virtual pixel scaled according to density and user font preferences.

The default value of an sp is the same as the default value for a dp. The primary difference between an sp and a dp is that sp’s preserve a user’s font settings.

  • Text Micro Size — 12sp
  • Text Large Size — 22sp

References — https://developer.android.com/training/multiscreen/screendensities

Happy Reading :)

--

--

No responses yet