Reputation: 1528
I'm almost at the end of the dev of an app, and for now, I've put every image I use (whether it's icons, buttons, or photos) in 4 sizes.
For example let's say I've got a photo that I want to be 300x120dp, I've put:
First question: is it the best practice? Even for rather large photos? Just to be sure I understand: why can't we put a 900x360px photo in drawable folder and set the size in dp in the layout so that the image is scaled down on small screen densities? For memory optimization?
Most importantly, I'm now working on layouts for 7 inches and 10 inches tablets. Let's take the same image of 300x120dp. This image is too small for a 10 inches tablet, and so I would like it to be 600x240dp on that screen size. What must I do? Generate 4 new images? If yes, let's say all my images are 2 times larger on a 10 inches tablet, must I generate 4 new images for all the images? And 4 new images for the 7 inches layouts?
Many thanks for your advices.
Upvotes: 0
Views: 99
Reputation: 14338
If you have a photo (just photo, not graphic with sharp edges like icons and so on!) -- practically there is no need to make it for xxhdpi, or even xhdpi, pixels there are not recognizable by eye. And make devices with medium resolution downsample hi-res pictures is bad practice, because often such devices have memory limits. Remember that image in mdpi is 4 times lighter than xhdpi and 9 times lighter than xxhdpi.
So, for photos (not icons and ui elements!): mdpi, hdpi, both for phones and tablets, will be enough.
Upvotes: 1