Alex Rivera | Logout

How to maintain backwards compatibility while utilising Android API Level 15?

Asked 2012-04-10T18:38:52.410
10

Ice cream sandwich introduced a lot of new UI design elements but market penetration is still only 4% or so. If one wanted to future-proof their application and utilise some of the design elements introduced with Honeycomb/Ice Cream Sandwich, such as the action bar, the colour scheme etc., what would be the best way to ensure you maintain some modicum of backwards compatibility?

Edit
Report

1 Answer

10

While I agree with @Ollie C, I think there are other options to add other than just using the Actionbar Sherlock library, while saying this I actively participate in the ABS community and agree it is fantasmagoricly really useful and contains all the UI assets will probably need.

You could look at graceful degradation of UI components back through the API levels. So for example:

You could create in the values folder and set the style like so

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Any customizations for your app running on pre-3.0 devices here -->
    </style>
</resources> 

Then for Android 3.0+ devices, create values-v11 folder:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.Holo.Light">
        <!-- Any customizations for your app running on 3.0+ devices here -->
    </style>
</resources>

And for 4.0+ devices, create values-v14:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="MyAppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
        <!-- Any customizations for your app running on 4.0+ devices here -->
    </style>
</resources>

REF: http://android-developers.blogspot.co.uk/2012/01/holo-everywhere.html, How to use Holo.Light theme, and fall back to 'Light' on pre-honeycomb devices?

There is also this project: answered 2012-04-10T19:12:32.360

Your Answer