30

I have a few questions:

  1. What is the screen size?

  2. What is the screen density?

  3. What is a difference between screen size and screen density?

  4. How I can support different densities and different screen sizes in Android?

I have already read the official documentation, but I was unable to understand the difference between screen size and screen density.

Kerrek SB
  • 447,451
  • 88
  • 851
  • 1,056
K Guru
  • 1,272
  • 2
  • 15
  • 35

5 Answers5

43
  • Screen density means how many pixels appear within a constant area of the display, dots per inch = dpi
  • Screen size means amount of physical space available for displaying an interface, screen's diagonal, inch
  • Screen resolution means number of pixels available in the display, scale-independent pixel = sp
  • density-independent pixel = virtual pixel that is independent of the screen density, dp

Density Classes:

Density Class

Icon Sizes:

Icon Sizes

  • (1) Google documentation says: "Applications should not generally worry about this density; relying on XHIGH graphics being scaled up to it should be sufficient for almost all cases."
  • Launcher icons for Android Market: 512x512 px.

Screen Size Classes:

Screen Size Classes

Screen Configuration:

Screen Configuration

  • (1) To emulate this configuration, specify a custom density of 160 when creating an Android Virtual Device that uses a WVGA800 or WVGA854 skin.
  • (2) To emulate this configuration, specify a custom density of 120 when creating an Android Virtual Device that uses a WVGA800 or WVGA854 skin.
  • (3) This skin is available with the Android 3.0 platform.

Best Practices:

  • Use wrap_content, match_parent, or dp units when specifying dimensions in an XML layout file. Except for defining text sizes: sp (scaling depends on user setting)

  • Do not use hard coded pixel values in your application code.

  • Do not use AbsoluteLayout,use Relative Layout.

  • Supply alternative bitmap drawables for different screen densities.

  • Provide a launcher icon for xxhdpi, but no other icons.

The Holy Coder
  • 6,374
  • 8
  • 36
  • 71
  • I have use this [play.google.com/store/apps/details?id=lt.andro.screensize ]to measure my screen size this application give me a screen size 720x1280 but you said that screen size unit is "inch" – K Guru Mar 14 '14 at 06:35
  • It's not size, It tells you screen resolution. Which device you have? – The Holy Coder Mar 14 '14 at 06:44
  • Note that the word "resolution" is used differently in different domains. When talking about screens, it refers to the absolute number of pixels on the screen. When talking about printing, it refers to the pixel density of the print, similar to your "screen density" here. Such is life. – Kerrek SB Jun 23 '15 at 08:31
  • So it appears that `screen density` is exactly the same as `pixel density`, isn't it? Read from GMD site `The number of pixels that fit into an inch is referred to as “pixel density.”`. Why they call the same thing differently? – Green Dec 16 '16 at 07:42
  • Can we find screen density in phone specification page ? – Reejesh PK Sep 14 '20 at 09:57
6

screen size is about how many pixels you can show on screen.

Density is based on your device real size, if it's small and has a higher resolution, than the density is high cause you show more pixels in less physical space.

1.screen size concerns an absolute number of pixels. (check out wikipedia Image Resolution)

2.Density (aka Pixels per inch - PPI) concerns a relative number of pixels per inch. (check out the wikipedia Pixel Density)
dipali
  • 10,619
  • 5
  • 24
  • 50
2

To put it simple:

  • Screen size is the physical size of the screen (whether in inch or cm)
  • Screen density is the ratio of how many pixels / area of screen size (that's why the unit is dpi, or dots per inch)
Andrew T.
  • 4,637
  • 8
  • 40
  • 60
2

Simply put, screen size refers to the size of the screen.This varies from device to device.screen density refers to the amount of pixels in a screen.Both are not independent though as screen size affects screen density.

Ojonugwa Jude Ochalifu
  • 25,513
  • 26
  • 111
  • 128
1

There are different terms and can't be used interchangeably

density = how many pixels appear within a constant area of the display, dots per inch = dpi or ppi(pixels per inch )

size = amount of physical space available for displaying an interface, screen's diagonal, inch

resolution = number of pixels available in the display, scale-independent pixel = sp

Dipika
  • 584
  • 2
  • 12
  • I have use this [https://play.google.com/store/apps/details?id=lt.andro.screensize ]to measure my screen size this application give me a screen size 720x1280 but you said that screen size unit is "inch" – K Guru Mar 14 '14 at 06:27