Minimum set of assets to cover all screen sizes, densities, and orientations on Android

I’m working on an Android project, and we have a splash screen where the user logs in that has a background image that takes up the entire screen. What is the minimum set of assets needed for this? The documentation suggests to provide different bitmap drawables for different screen densities, and to use size and density-specific resources. We also allow portrait and landscape orientation, so my designer gave me 18 bitmaps to cover large, normal, and xlarge screens each with portrait and landscape bitmaps in each (mdpi, hdpi, and xhdpi) density. This seems a bit excessive to me. Any suggestions?

Answer

From your documentation:

You only need to provide density-specific drawables for bitmap files
(.png, .jpg, or .gif) and Nine-Path files (.9.png). If you use XML
files to define shapes, colors, or other drawable resources, you
should put one copy in the default drawable directory (drawable/).

This implies that other types of non-bitmap “drawables” (XML, Vector) are supported. So for the case of a splash screen, perhaps one might design it simply with large color block(s), some text and a single vector image (logo). This way, the color is a “flood fill” or gradient (two or three gradients from color to transparent at differnt angles overlaid can be quite nice) which is handled dynamically by software, the text is handled by the type services of the device (and localizable), and the drawable’s resolution (and/or scale) is set at the time of display. You will wind up with a single set of assets and the best-case scenario regarding resolution. This also has the benefit of far less storage and drawables may be reusable in other contexts.

This is device- and program-capability specific.

Alternatively, one might design for the largest size being mindful of small-screen crop (like pan’n’scan for movies), set the drawable to “center without zoom”.

Attribution
Source : Link , Question Author : Christopher Perry , Answer Author : horatio

Leave a Comment