Selecting theme based on the Android version

Most users prefer to see apps using the latest themes provided by Android. Now supports Material Theme is common for apps upgrading to Android Lollipop. To be competitive with the many other apps in the market, you'll probably want to upgrade your app as well, but what about your users who are still running older versions of Android? By setting up our resources properly, we can use resource selection in Android to automatically define the parent theme based on the Android OS version the user is running.

First, let's explore the three main themes available in Android:

  • Theme – Gingerbread and earlier
  • Theme.Holo – Honeycomb (API 11)
  • Theme.Material – Lollipop (API 21)

(As of writing this, there does not appear ...

Get Android Application Development Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.