-1

I am trying to build an application for Android.
I have a problem to understand the screen density.
According to this:

  • LDPI: Low density, ~120 dots per inch
  • MDPI: Medium density, ~160 dots per inch
  • TVDPI: Medium High density, ~213 dots per inch
  • HDPI or HiDPI: High density, ~240 dots per inch
  • XHDPI: eXtra High density,~320 dots per inch
  • XXHDPI: eXtra eXtra High density, ~480 dots per inch
  • XXXHDPI: eXtra eXtra eXtra High density, ~640 dots per inch

when I should try to set density at 120 dpi, using the command wm density 120 the stock density at my Note 3 (480 dpi) should be changed with less dots per inch and that means that less items should fit to the screen.
But, when I execute it the items on the screen are shrink and I get a better density!

What am I not understanding well?

LiTTle
  • 1,811
  • 1
  • 20
  • 37
  • Check this link http://stackoverflow.com/questions/3166501/getting-the-screen-density-programmatically-in-android – Bhavesh Jabuvani Oct 29 '14 at 16:21
  • Do you know the difference between density and resolution? – 323go Oct 29 '14 at 16:40
  • Density has to do with dots per inch. In case of screens it is pixel per inch! The more pixels per inch you have the sharpest the image. More pixels, means more details, more sharpness. So, if we have a screen with 640 dpi means more details than a screen with 120 dpi. If what I know is wrong please point me to the right direction to read, but if I am right try to execute the command above! – LiTTle Oct 29 '14 at 17:05

2 Answers2

1

When you change the density, your physical screen does not change. So for example, let's say an icon is .5 in x .5 in. With a higher screen density, it takes more physical pixels to get .5 in (3 times in your case). By lowering your screen density, Android thinks it needs to use less pixels to achieve the same physical size, thus the screen appears smaller.

Dan Harms
  • 4,725
  • 2
  • 18
  • 28
  • So, does Android try to keep the size of the contents same according to physical size of the screen? I don't think it achieves this goal! – LiTTle Oct 29 '14 at 16:24
  • Everything on the screen is usually sized with density pixels (dp). You are changing the unit of measurement from 1 dp = 3 pixels to 0.75 pixels. This makes everything 4x smaller. – Dan Harms Oct 29 '14 at 16:34
0

To achieve it the way you want it you should set wm size [hori]x[vert] (like wm size 1280x720) as well. This way android is calculating your (physical-)screen as it would be like 3 times bigger.

blender
  • 361
  • 3
  • 16