All I have a different layout files for different versions of android like layout-v13
, but I noticed that the files are the same for newer versions of android (API 11-16). Is there a way to group them together as something like layout-v11,12,13,14,15,16
? Thanks for your time!
If what you're trying to do is show a different layout depending on which API version is available on the device, you want to use configuration qualifiers. The specifics for alternative resources are also documented.
The most basic way to do it is to create a layout folder for each API level you want to use, formatted as follows:
res/layout/layout.xml (Default)
res/layout-v4/layout.xml (Android 1.6 and higher)
res/layout-v11/layout.xml (Android 3.0 and higher)
From Android official documentation
In your case layout-v11
this will be used by devices running Android 3.0 Honeycomb and above
layout-v11
will be used by all devices running Android 3.0 and above. You should only break up the folders (i.e. layout-v11
, layout-v12
, etc.) if devices running the specific version require a different layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With