In drawable-mdpi, etc. There are pictures for various screens. The application also has an activity with thumbnails of these pictures. As the thumbnails, the images themselves are loaded and artificially compressed ( ImageButton
with the setAdjustViewBounds(true)
attribute setAdjustViewBounds(true)
). For the xhdpi
screen xhdpi
in principle, there would be enough ldpi
pictures as a preview, so as not to xhdpi
power to reduce xhdpi
-pictures. Is it possible to somehow force the application in a particular case, regardless of the type of screen, to load pictures from drawable-mdpi
?
|
4 answers
Look toward Resources.getDrawableForDensity(int id, int density)
PS Works only under API> = 15
|
Put this picture only in the drawable-mdpi
. Android itself will take it, but how it will stretch / squeeze you will need to have a look.
|
Add to manifest and configure as desired
<compatible-screens> <screen android:screenSize="small" android:screenDensity="ldpi"/> <screen android:screenSize="small" android:screenDensity="mdpi"/> <screen android:screenSize="small" android:screenDensity="hdpi"/> <screen android:screenSize="small" android:screenDensity="xhdpi"/> <screen android:screenSize="normal" android:screenDensity="ldpi"/> <screen android:screenSize="normal" android:screenDensity="mdpi"/> <screen android:screenSize="normal" android:screenDensity="hdpi"/> <screen android:screenSize="normal" android:screenDensity="xhdpi"/> <screen android:screenSize="large" android:screenDensity="ldpi"/> <screen android:screenSize="large" android:screenDensity="mdpi"/> <screen android:screenSize="large" android:screenDensity="hdpi"/> <screen android:screenSize="large" android:screenDensity="xhdpi"/> <screen android:screenSize="xlarge" android:screenDensity="ldpi"/> <screen android:screenSize="xlarge" android:screenDensity="mdpi"/> <screen android:screenSize="xlarge" android:screenDensity="hdpi"/> <screen android:screenSize="xlarge" android:screenDensity="xhdpi"/> </compatible-screens>
|
No matter how, all your pictures will be available at the same file: /// android_res / drawable address, which are not needed for this device will not be unpacked.
|