Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 501
Sanath Avatar asked May 23 '12 08:05

Sanath


3 Answers

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.

like image 121
Bannane Avatar answered Nov 12 '22 23:11

Bannane


Try to use HoloEverywhere as parent theme.

like image 3
galex Avatar answered Nov 12 '22 21:11

galex


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

like image 1
Dirk Jäckel Avatar answered Nov 12 '22 22:11

Dirk Jäckel