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
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: https://github.com/ChristopheVersieux/HoloEverywhere that it attempting to bring the holo theme.
Finally; Google encourage the developers to include UI components from the SDK to help with the backward compatibility issue, rather than referencing them directly from the Android OS. While this is not your question, it does help provide some consistency.
This is a very, very broad topic. The answers vary depending on what specific element you're trying to use.
-For the ActionBar: If you want an ActionBar in earlier versions, ActionBarSherlock is a popular, free library extended from the Android support library.
-For the Color scheme / theme: As described in this SO thread, create a res/values/styles.xml and res/values-v11/styles.xml, (for instance, called "myStyle"), for each style pick a relevant parent. For V11, it would probably be "Theme.Holo", wheras for the other, probably "Theme.Dark". Add any customizations you want to the themes. Reference that custom theme in your manifest, and the right one will be chosen depending on the platform version of the device (values-v11 folder will be used for Honeycomb and up, the other for Gingerbread and below)
-For other platform features, you can encapsulate platform-specific functionality in separate classes, and access them based on the value of Build.VERSION.SDK, as described on the android developer blog.
http://www.actionbarsherlock.com
This (free) library is brilliant, and provides what you are looking for on prior Android versions.