Professional Documents
Culture Documents
Android: How To Use Different Themes For Different Android Versions?
Android: How To Use Different Themes For Different Android Versions?
Página 1 de 4
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no
Tell me more ×
registration required.
MinSDKVersion = 7 TargetSDKVersion = 17
If the user have SDKVersion 11 or higher I like to set the theme to Theme.Holo.Light. It doesn't works for me
here. When I launch the app on a 3.1 device it just uses the Theme.Light:
Same when I run this app on a device with lower version than 3.1
My Folderstructure:
http://stackoverflow.com/questions/14335453/android-how-to-use-different-themes-fo... 18/11/2013
Android: How to use different themes for different android versions? - Stack Overfl... Página 2 de 4
Manifest:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme" >
values-v11:
<resources>
<!
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/valuesvXX/styles.xml on newer devices.
>
<style name="AppBaseTheme" parent="@android:style/Theme.Light">
<!
Theme customizations available in newer API levels can go in
res/valuesvXX/styles.xml, while customizations related to
backwardcompatibility can go here.
>
</style>
<! Application theme. >
<style name="AppTheme" parent="@android:style/Theme.Light">
<! All customizations that are NOT specific to a particular APIlevel can go here
</style>
http://stackoverflow.com/questions/14335453/android-how-to-use-different-themes-fo... 18/11/2013
Android: How to use different themes for different android versions? - Stack Overfl... Página 3 de 4
<resources>
<!
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/valuesvXX/styles.xml on newer devices.
>
<style name="AppBaseTheme" parent="@android:style/Theme.Light">
<!
Theme customizations available in newer API levels can go in
res/valuesvXX/styles.xml, while customizations related to
backwardcompatibility can go here.
>
</style>
<! Application theme. >
<style name="AppTheme" parent="@android:style/Theme.Light">
<! All customizations that are NOT specific to a particular APIlevel can go here
</style>
2 Answers
Delete the one you don't need(In this case the Theme.Light theme):
values-v11:
values:
I did that but it still showed the old theme and not the holo theme on my android 4.1 AND 3.1 device–
Marco Seiz Jan 15 at 10:27
Yep I did. I figured out the error. I had to create two folders for one language. For german: values-de AND values-
de-v11 and same for english... It works now :) Thanks for your helps and tips!– Marco Seiz Jan 15 at 10:33
http://stackoverflow.com/questions/14335453/android-how-to-use-different-themes-fo... 18/11/2013
Android: How to use different themes for different android versions? - Stack Overfl... Página 4 de 4
Place the solution provided by @Ahmad in new files called themes.xml on the directories he said :-)
If you'll use multilanguage and multithemes, you can take a look at a similar question I did some minutes
before... and got answered:
Not the answer you're looking for? Browse other questions tagged android themes
http://stackoverflow.com/questions/14335453/android-how-to-use-different-themes-fo... 18/11/2013