Sanath
Sanath

Reputation: 493

Android Holo themes with backwards compatibility

I have built android app with supporting android:minSdkVersion="7" android:targetSdkVersion="15". I use my customized theme inheriting Android default theme.

so now i want to change whole application theme to Holo theme.Can any one help me on this.

Upvotes: 5

Views: 6739

Answers (3)

Bannane
Bannane

Reputation: 145

You can implement a "style selector" by using different style XMLs.

Just define a theme named "StyleSelector" or something like that in /res/**values**/styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="ThemeSelector" parent="@android:style/Theme.Black">
    ... Your theme definitions
    </style>
</resources>

Then create a /res/**values-v11**/styles.xml:

<resources>
    <style name="ThemeSelector" parent="@android:style/Theme.Holo">
    </style>
</resources>

Now just apply your theme with "@style/ThemeSelector" and let Android do the magic. On older Android versions, your theme definition will be loaded, on newer versions with Holo-Support, your theme will be derived from Holo.

Upvotes: 10

galex
galex

Reputation: 3319

Try to use HoloEverywhere as parent theme.

Upvotes: 3

Dirk J&#228;ckel
Dirk J&#228;ckel

Reputation: 3025

Just modify the application tag in the AndroidManifest.xml that it contains the theme:

android:theme="@style/Theme.Holo"

For example like this:

<application android:icon="@drawable/ic_launcher"
             android:label="@string/app_name"
             android:theme="@style/Theme.Holo">

Or you can do it on a per Activity basis. Here is the relevant documentation: https://developer.android.com/guide/topics/ui/themes.html

Upvotes: 1

Related Questions