I’m creating an Android application, and want different background images for phone sized screens and tablet sized ones. I already have different resolution images for different resolutions (mdpi, hdpi etc.). The challenge is that most tablets use mdpi, but some phones might use it too.
I’ve tried to do some research, but only it seems to be possible to define screen sizes in the layouts, e.g. res/layout/layout-large. Does that mean I have to create a separate xml for tablets, linking to a @drawable/tablet-background? Or is there any other solutions, either xml or programmatic?
Try the qualify the
drawablefolder with the desired screen size and also the density value for the target device, for exampledrawable-large-mdpi. The screen size must come first based on the configuration qualifiers table.