I am preparing my app to work smoothly with honeycomb. I have an small aesthetics question regarding with the android theme.
For honeycomb it is recommended that the following theme is used.
How can I make my app use another theme when it is used in a previous version?
Thanks in advance
EDIT: Updated for released version of the 3.0 SDK.
One way to do this is to set
<uses-sdk android:targetSdkVersion="11">. You should also place this above your
<application> definition. This will tell the system to use the Holographic theme if it’s available, and the default theme otherwise.
Another way to do this, is to define a theme, say
MyTheme, that inherits from a different theme depending on the API level / OS version. You can do this using resource directory qualifiers.
Your directory structure could look like this:
res/ values/ styles.xml values-v11/ styles.xml
The contents of
res/values/styles.xml would be something like:
<resources> <style name="MyTheme" parent="@android:style/Theme.Light"> ... </style> </resources>
And the contents of
res/values-v11/styles.xml would be something like:
<resources> <style name="MyTheme" parent="@android:style/Theme.Holo.Light"> ... </style> </resources>
Note that in the future, the Holo theme may not always make sense by API level, so you may need to tweak this approach later on. You can also use other directory qualifiers such as
values-large-v11 or the like. It’s entirely up to you.