Reputation: 2064
Most of the link on SO suggest to use same image with different sizes in ldpi
, mdpi
, hdpi
, xdpi
. But the problem is I have more than 15 images. If I do like they suggest i think its increase the size of my app. As each image is at least 50 kb. Is there is any other way to use so many images that support all screen sizes? And if i use each image with different sizes in ldpi
, mdpi
, hdpi
, xdpi
. Is this increase my app size?
Upvotes: 2
Views: 212
Reputation: 14223
Unless you do not have hell lot of images in your app, it is okay to have app size increase, yes it good to design app to have less in size but keep in mind that, if its required its okay to have a app size maximum upto 50Megs~Read Android Apps Break the 50MB Barrier
Another way to go with supporting images to have support for varied screens, go with Nine-patch images. A NinePatchDrawable
graphic is a stretchable bitmap image, which Android will automatically resize to accommodate the contents of the View in which you have placed it as the background. Read Nine-patch
Upvotes: 3
Reputation: 12219
You can go without downscaling all the the different sizes, but then you must be aware of the two major issues:
There is a performance penalty of Android having to downscale the images manually every time they are accessed. This is especially an issue on older/slower devices. This could cause your list views to stutter, increase load times and generally make things lag in the worst case. I'm not entirely certain, but you may also run into memory issues on devices with little RAM.
Automatic downscaling of some images will lead to a bad visual result. Especially with fine detail or in the case of logos, where everything should look as good as possible. In particular this is an issue the more the image is downscaled. So if you provide an XXHDPI image only, then it will likely not look good on MDPI or LDPI devices.
As long as these two points are less of an issue than the application size, then you can consider leaving it up to Android to downscale. Though in most cases you're looking at around 3 times more storage space required than if you didn't include them (keen in mind that they are smaller images, so they take up a lot less space. A 50kb xdpi image will have an equivalent mdpi images at 12.5kb because both width and height are halved).
Also note that if you must only provide one image, then it should be the highest resolution image available, otherwise the image will be upscaled which looks terrible on higher resolution screens.
Finally, worth noting is that the Android will compress the images in the APK, so the file size you see may not be the same as the amount of space it takes up in the APK.
For the sake of completeness, as @Akhil Jain mentioned. A great way to reduce your image space cost is through the use of 9 patches. Be sure to use them whenever appropriate.
Upvotes: 1
Reputation: 2127
A short answer, YES, it will increase your app's size if you prepare all ldpi, mdpi, hdpi, xhdpi
images.
In some special case, if your app have really large image for tablet, you can use Multiple Apk Support.
This will let you create different apk which has limited image resource only target for limited devices.
Upvotes: 2
Reputation:
yes this will increase your apk
size and the application size because apk
is downloaded together with all images for all resolutions. If you want any images common for all screens, then you can create a drawable folder
and place the image in it. So it will pick automatically. For more detail go through this link Supporting Multiple Screen.
Upvotes: 1