I have added widget functionality to my app, which is compatible with older versions of Android (back to 1.6). Widgets in Android 3.1+ support the xml tag resizeMode which is a very useful feature and I’d like to allow users to resize their widgets.
But I’d like to still be backwards compatible with 1.6 (or 2.1 would be good enough too).
How can I do this? Can I have selective xmls?
Currently I am tagetting 1.6.
Thanks!
You can put resources that are intended for more recent API levels in resource directories that are qualified by the minimum API level supported. For instance, you could have the 1.6 version of the xml files in res/layout and put the 3.1+ versions in res/layout-v12 (the “-v12” resources will only be considered when running under Android 3.1 and later, regardless of what the target level is). You can apply these qualifiers (as described here) to any resource type, not just layouts.