Learn how to use the new Android Themes in your App

Newer versions of Android have additional themes available to applications, and you might want to use these while running on those platforms while still being compatible with older versions.  – Android Documentation

Since your app targets devices which run on API level 17 and above you don’t need to provide backward compatibility. You can make use of the new Themes.

Let’s see how.

You are going to change the app so that it uses Theme.Holo.Light by default and switches to Theme.Material.Light if app is running on API level 21.

  1. Open MainActivity class. Change ActionBarActivity to Activity.
  2. You will notice there are two style.xml files. One which supports v21 and other for lower versions (default).

Change default style.xml to use the following parent theme – android.Theme.Holo.Light

Change v21 style.xml to use the following parent theme – android.Theme.Material.Light

Follow the video to understand better. Source Code is available here

Author: androidsmartly

I am a Tech Enthusiast who likes to work on new Ideas. Sharing knowledge on Android, Marketing, Startups and More.

1 thought on “Learn how to use the new Android Themes in your App”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s