简体   繁体   中英

Holo Theme and API 8

I have an app that must be supported from API 8+. But I also like to have my app the holo theme for(11+). I know it won't be supported as the min sdk is 8. So the only solution will be to create 2 separate apps one for 8-11 and one for 11+. Is there any better way to do this? So that I can reduce double maintenance.

There's no need to create two separate apps. You just need to create two definitions of theme for your app:

styles.xml in /res/values-v11 (Will be used only on API 11+)

<resources>
    <style name="app_theme" parent="android:Theme.Holo.Light"/>
</resources>

styles.xml in /res/values

<resources>
    <style name="app_theme" parent="android:Theme.Light"/>
</resources>

and then, apply it to your application in AndroidManifest.xml:

<application
        ...
        android:theme="@style/app_theme"
        >
  ...
</application>

This setup uses resource qualifiers. You can read more about them here .

You can try the HoloEverywhere library to use Holo theme on Android 2.1+. It also integrates well with ActionBarSherlock .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM