Measurement units in Android

Android provide specific units of measurement, you should be aware of them at the time of giving size of an element on an Android UI.

  • dp - Density-independent pixel. 160dp is equivalent to one inch of physical screen size.
     
  • sp - Scale-independent pixel. This is similar to dp and is recommended for specifying font sizes.
     
  • pt - Point. A point is defined to be 1/72 of an inch, based on the physical screen size.
     
  • px - Pixel. Corresponds to actual pixels on the screen.

Thank You...

Ebook Download
View all
Learn
View all