I want to create an Android app with ImageButton
s that look good, and appropriately-sized, on a wide variety of devices. I'm aware that multiple levels of conditionality can be built into Android drawables, the simplest being to create folders like
drawable-ldpi
drawable-mdpi
drawable-hdpi
drawable-xhdpi
for different densities of bitmap. However, buttons that look good on an mdpi phone look poky on an mdpi tablet, and I'd rather use the hdpi bitmaps for that application. There is a way to do this using folders named like
drawable-small-ldpi
drawable-normal-ldpi
drawable-large-ldpi
drawable-xlarge-ldpi
drawable-small-mdpi
drawable-normal-mdpi ...
etc. As you can see there are sixteen different folders to cover conditional screen sizes for each density. I can probably reduce this somewhat by using defaults like
drawable-ldpi
drawable-large-ldpi
drawable-xlarge-ldpi ...
but my intention is to use the SAME drawables for large and x-large screens on one density as for the small and normal screens on the density above. I feel that this method is a waste of resource space in the APK. Is there a way to create SINGLE drawable folders that contain images targeted for:
- Small low-density devices
- Large low-density AND small medium-density devices
- Large medium-density AND small high-density devices
- Large high-density AND small extra-high-density devices
- Large extra-high-density devices?
Alternatively, is there another way to assert conditionality based on device size AND device density?