ConfigureProgram:
<Supports-screens Android: resizeable = "true" Android: smallscreens = "true" Android: normalscreens = "true" Android: largescreens = "true" Android: xlargescreens = "true" Android: anydensity = "true"/>
ThenCodeCall bitmapfactory. decoderesource (read a resource,
If the mobile phone is mdpi, the read size is the same as the image size.
If the mobile phone is xhdpi, but the drawable-xhdpi does not include this file, the Read File is twice the original image, it seems that android doubles the files in drawable and copies them to the drawable folder.
If no image is displayed in each directory, Android automatically obtains the following file size ratio:
Ldpi 120
Normal 240
Hdpi 1, 360
Xhdpi 480
To read the same size at all density, do you have to copy all the images to the corresponding density path?
Otherwise, the Code cannot predict the size of the image to be read? Actually, yes.
Bitmapfactory. Options opt = new bitmapfactory. Options (); opt. intargetdensity = nmyscaletimes = 1? Displaymetrics. density_medium: displaymetrics. density_xhigh; bitmap BMP = bitmapfactory. decoderesource (m_res, (integer) resurl. geturl (nreskey), OPT );
In the above Code, when nmyscaletimes = 1, the image is not scaled; otherwise, the size of xdpi is exactly twice that of medium, and medium is not scaled.
In this way, you only need to put the original image in drawable-mdpi. It doesn't matter if drawable-xhdpi is not put. If it is put, it will be placed twice as large as the original size graph.