Reputation: 954
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:
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/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
other values folders:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="@android:style/Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="@android:style/Theme.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="@android:style/Theme.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
How can I use this correctly?
Sincerely Marco Seiz
Upvotes: 6
Views: 14568
Reputation: 162
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:
Multilanguage and multitheme at same time
Upvotes: 2
Reputation: 72563
Why do you have your theme twice in your styles.xml file?
<style name="AppTheme" parent="@android:style/Theme.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
Delete the one you don't need(In this case the Theme.Light theme):
values-v11:
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
values:
<style name="MyTheme" parent="@android:style/Theme.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
Upvotes: 6