Hi I am having an old app created on version 2.2.3.
I am modifying the app for 4.0 and above version handsets.
can someone tell me if I can use selective theme
like for 2.2 devices dark black theme
For 3.0 and above the holo
Can i use version specific themes?
Create a different values folder with following name:
values-v17
and put a copy of style.xml init
in this style.xml you can overrite styles set in default values folder and for the devices with API-17 this style will be applied
If you have a folder for values-v11 all the devices with API level 11 and more will refer to files from this folder.
Related
What is the main difference between these two files : styles.xml (res\values\styles.xml) and styles.xml (res\values-v21\styles.xml ?
For targeting old android versions, which file should we modify?
Android will use res\values-v21\styles.xml if the user's device is running Android API level 21+ (Android 5.0+) & will use res\values\styles.xml for older versions
It just means that the styles differ in android versions.
styles.xml in values-v21 mean that, that particular style is for Android API 21 version 5.0+
while styles.xml will be for any other Android version besides 5.0+.
its the same as language where you create an activity for en, fr, pk etc.
Older version would automatically be targetted by the values/styles.xml file.
My Android project was working fine when I noticed that I had checked SDK version 4.2 when I meant to target Google 2.33. I set the project back to G2.33 (In the manifest it minsdk = 8 targetsdk=11) and now I have errors on two different styles.xml files in two folders named Values-v11 and values-v14.
the styles.xml in the Values-v14 folder has an error on the following line...
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
the st yles.xml in the Values-v11 folder has an error on ...
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
My other projects, that all target 2.33 don't even have these folders. What is the best way of me getting out of this mess?
Thanks, Gary
You could simply delete these folders if you don't want anything specific for SDK level 11, and the one for 14 won't be used anyway if your targetsdk is 11.
If you want to retain the one for api level 11 for custom behaviour in API level 11, you need to set the project to compile with API level 11 - i.e. if in Eclipse, select the project, go to Properties, select Android and then set the project build target to "Android 3.0" or "Google APIs" for API level 11 if you need the Google APIs.
If I am developing an app app that could use any version of styles.xml is it possible to write code in one version of this file and have the other versions reference that code, rather then having to repeat the code multiple times?
I am using Eclipse, which has multiple versions of styles.xml:
res -> values -> styles.xml
res -> values-v11 -> styles.xml
res -> values-v14 -> styles.xml
Yes things declared in lower api level versions can be accessed.
I want to apply holographic theme when my app runs on 3.0 or higher and use default dialog theme when run on < 3.0.
For that I tried Change theme according to android version. I set the target sdk version = 11 to work for holographic theme in 3.0 and above and it is working for my simple dialog activity (without changing project.properties file android version) but if i declare the same for my library project holo theme is not inherited when I run my app on 3.0 or higher device. It shows dialogs with old theme.
I dont want to change my project.properties file android version.
I don't understand why it is not working in my library project. I also tried creating values-v11 folder and adding but I'm getting the error:
Description Resource Path Location Type error: Error: No resource found that matches the given name (at 'theme' with value '#android:style/Theme.Holo.Light').AAPT Problem
Please help me, I'm stuck.
I currently have an Android application targeting version 11 of the SDK with a minimum version of 4. I would like to apply the Light version of the Holo theme if the app is running on Honeycomb. Following the instructions here I have tried adding the following to res/values-v11/themes.xml but my application will not compile because #android:style/Theme.Holo.Light does not exist in SDK 4
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
</style>
</resources>
Is is possible to get a reference to that theme without having to build separate 1.6-2.x and 3.x versions of my application?
As EboMike pointed out in the comments this was a problem with setting the build target to the Minimum SDK version instead of the Target SDK version.