mdpi HVGA (320×480)
hdpi WVGA (480×800),FWVGA (480×854)
xhdpi 720P( 1280*720)
xxhdpi 1080 p( 1920 * 1080)
xxxhdpi 4K(3840×2 160)
4:3
VGA 640*480 (video graphics array)
QVGA 320*240 (quarter VGA)
HVGA 480*320 (half-size VGA)
SVGA 800*600 (Super VGA)
5:3
WVGA 800*480 (wide VGA)
16:9
FWVGA 854*480 (full-width VGA)
HD 1920* 1080 HD
QHD 960*540
720p 1280*720 SD
1080p1920 *1080 HD
Pixels per inch
HVGA mdpi
WVGA hdpi
FWVGA hdpi
720P( 1280*720) xhdpi
1080 p( 1920 * 1080)xxhdpi
Density recommended size
mipmap-mdpi 48 * 48 1
mipmap-hdpi 72 * 72 1.5
mipmap-xhdpi 96 * 96 2
MIP map-xxhdpi 144 * 144 3
MIP map-xxxhdpi 192 * 192 4
1. calculate dpi->; Pixels per inch
For example, there is a mobile phone with a 4-inch screen and a resolution of 480X800. How to calculate its dpi?
Because we don't know the side length, we can't calculate it separately. 4 is the diagonal length, so we can directly use Pythagorean theorem to calculate diagonal pixels. Divided by 4, it will be roughly dpi = 233 pixels/inch.
Then the density is about (233 px/ inch) /( 160 px/ inch) = 1.46.
By the way, Android has only three dpi by default, low, medium and high, corresponding to 120,160,240. If there is no special setting, all dpi will be counted as these three, and the default is 160.
2. calculate dp and px
When we write the layout, we must still know how many px there are in 1 dp.
The conversion formula is as follows: dp = (DPI/( 160 pixels/inch)) px = density px.
Attention, this is all units. Px is the unit, dp is the unit, and density has no unit.
For convenience, assume that the dpi is 240 pixels/inch, and the density is 1.5.
Then it is DP =1.5px. Note that this is the unit, that is, device-independent pixels = density pixels. If converted into numerical calculation, it should be the following formula.
PX = density * DP
Tisch
Over the past year, under the unified leadership of the bureau party group and the care, support a