3

The Google Maps reference on projections says:

Screen location is in screen pixels (not display pixels) with respect to the top left corner of the map (and not necessarily of the whole screen).

What is the difference between screen pixels and display pixels? The official documentation also doesn't answer the question.

Alexander Pacha
  • 9,187
  • 3
  • 68
  • 108

2 Answers2

3
  • Display pixels "look the same" even if the screens have different pixel densities (pixel density is determinated by the size of each pixel in that screen).
  • Screen pixels depend on the size of the pixels on the screen.

For example, Retina Display gadgets have very tiny pixels, so a width of "1sp" (sp = screen pixels) would be very small. A width of "1dp" would look the same in a Retina Display gadget and in a screen with big pixels.

Racso
  • 2,310
  • 1
  • 18
  • 23
1

The main difference between sp and dp is that the size of each dp is scaled depending on the pixel density of the device, while sp is also scaled but takes into account of the user's font size. You would use the unit dp to make sure your layouts look the same across devices with different pixel densities. Screen pixels are mostly used just for font sizes.

Check here for more information about the different types of units.

Community
  • 1
  • 1
Steven Huang
  • 490
  • 4
  • 16
  • Maybe the terminology was just not clear enough. Are you saying that display pixels are density-independed pixels? Because the documentation is talking about _Display Pixels_ and not _Density independent pixels (dp)_. – Alexander Pacha Jun 26 '13 at 23:24
  • 1
    The acronym dp is used interchangeably with dip, and they both stand for density-independent pixels. It does not mean "display pixels", but I guess they mean the same thing. To make it clear, just use sp for fonts and dp for everything else. Can't go wrong. – Steven Huang Jun 27 '13 at 00:36