Android_ basis of Resolution

Common screen resolution corresponding to the size

Standard screen Resolution proportion Widescreen Resolution proportion
QCIF 176X144 11:9      
CIF 352X288 11:9      
QVGA 320X240 4:3 WQVGA 400X240 5:3
HVGA 480X320 3:2      
VGA   640X480  4:3 WVGA  800X480   5:3
qHD   960X540  16:9      
HD/720P  1280X720   16:9      
HD+ 1600X900 16:9      
FHD/1080P   1920X1080  16:9      
FHD+  2160X1440   16:9      
 QHD 2560X1440   16:9      

 

 basic concepts

Screen size : the length of the line focus of the screen, in inches (inch).

Resolution : The above table is a high resolution and number of pixels of the wide screen. Such as 320x240, i.e., 320 pixels tall and 240 pixels wide points.

Screen densities (actual physical dpi): dpi (dots per inch ), i.e., the number of pixels per inch. The screen size is 4, the resolution is 320x240, the screen density (√ (320. 2 +240 2 )) / 4 = 100.

Density System ( System dpi): density, system default configuration fixed density.

The following information is the system density, mdpi (160) as the reference:

  ldpi mdpi hdpi xhdpi xxhdpi
System density 120 160 240 320 480
On behalf of resolution 240x320 320x480 480x800 720x1280 1080x1920
Reference ratio 0.75 1 1.5 2 3

 

Relationship between the various units: dp, px, sp

dp units commonly used in the layout, px i.e. pixels, sp commonly used in the font size. 

 dp and PX :

 dp px and conversion systems based on the density. In mdpi, 160 as a reference, as in the 320x480 1dp device, 1dp = 1px; 480x800 in the 1dp = 1.5px.

Property system configuration in the system density is ro.sf.lcd_density, codes obtained by the following

Log.d( TAG, "density="+getResources().getDisplayMetrics().density
            +";densityDpi="+getResources().getDisplayMetrics().densityDpi);

Phone (ro.sf.lcd_density = 240,480x960) execution of the results obtained

2019-09-29 10:27:52.432 5521-5521/com.flx.testfilestorage D/flx_storage: density=1.5;densityDpi=240

Therefore 1DP = Density PX or 1DP = ( densitydpi / 160. ) PX

 sp and PX :

 Android design principles font size to use sp, non-use font size dp. When the standard (default) font, 1sp = 1px.

Therefore, the standard (default) font case, sp px and transferred as dp, 1SP = Density px  or  1SP = ( densitydpi / 160. ) px.

The default setting of several selectable font size change value as follows (different mobile phone manufacturers may be revised, so that different phones may vary):

<item>0.85</item>   //小
<item>1.0</item>   //默认
<item>1.15</item>   //大
<item>1.30</item>   //最大

  

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/fanglongxiang/p/11577849.html