Search code examples
androidscreenpixel

What is the difference between screen pixels and display pixels


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.


Solution

  • 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.