Android:Various units of measure (DP, SP, PT, PX, MM AND IN)


For Android apps developement, there are six units of measure: 
dp: Density  Independent Pixel - abstract unit that is based on the physical density of the screen.This unit equals 160 DPI (dots per inch) . This dimension is used for elements' setting. 
sp: Scale independent pixels  - Used for font sizes.We could compare this unit to "em" in web development. The police may be larger or smaller depending on user preferences. 
pt: Point - 72 points per inch. based on the physical size of the screen. 
px: Pixels - Corresponds to actual pixels on the screen. This unit of measurement is not recommended as rendering on different types of screen can be different. The number of pixels per inch may vary depending on the device. 
mm: Millimeter - based on the physical size of the screen 
in: Inches (Inches) - based on the physical size of the screen 

These dimensions are defined in the layout (XML files). 


Commentaires

Posts les plus consultés de ce blog

Ionic 2 : Envoie d'une image vers un serveur web à l'aide de PHP et Angular 2

Premier tutoriel avec Arduino et Proteus ISIS

Login et password ,formulaire d'authentification sous android avec mysql et json