Android phone screen resolution and sp dip (dp) px difference

 Android phone screen resolution and the difference between sp, dip (dp), and px

Resolution refers to the number of pixels contained in a unit length, and its unit is usually pixels per inch (ppi). For a screen with a resolution of 1024×768 , that is, each horizontal line contains 1024 pixels , and there are 768 lines in total, that is, the number of scanning columns is 1024 columns and the number of rows is 768 lines. The resolution is not only related to the display size, but also affected by factors such as the dot pitch of the picture tube and the video bandwidth.

  Mainstream resolution:

  

code Resolution code Resolution
QVGA 320*240 pixels WQVGA 400*240 pixels
HVGA 320*480 pixels VGA 640*480 pixels
WVGA 800*480 pixels XGA 1024*480 pixels

 

 


QVGA stands for Quarter VGA. As the name implies, it is the quarter size of VGA. 
HVGA (Half-size VGA) is half of VGA (640*480).
WVGA is Wide VGA
WQVGA Full name: Wide Quarter Video Graphics Array

 

sp  dip  px

sp : (scaled pixels—best for text size)—scaled pixels It is mainly used for font display. Therefore, according to google's suggestion, the font size of TextView is best to use sp as the unit, and viewing the source code of TextView shows that Android uses horizontal as the font size unit by default.

 

dip:(device independent pixels)——Device independent pixel : This is related to the device hardware. Generally, we recommend using this to pixels . Equivalent to dp.

Generally, HVGA (320*480) is used as the standard. For example, if a Button control has a width of 160dip, the width of the Button in WVGA, HVGA, QVGA, and WQVGA is half of the screen.

 

px:px(pixels)——Pixels : Different devices have the same display effect. Generally, our HVGA represents 320x480 pixels , which is used more. 1dip = 1px in HVGA (use with caution!)

 

Summary: use sp for fonts, and dip(dp) for other controls

 

 Mobile phone screen width: It is usually expressed in inches, such as 2.4 inches, which means that the diagonal length of the screen is 2.4 inches (1 inch = 2.54 cm)

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326893183&siteId=291194637