Android Material Design
Basics
The theme is defined in the styles.xml. You have to make sure the minSdkVersion is compatible with the theme. The backward compatible themes without Material Design is
Theme.AppCompat
Theme.AppCompat.Light
Theme.AppCompat.Light.DarkActionBar
Theme.AppCompat.Light.NoActionBar
The equivalent Material Themes are
android.style/Theme.Material
android.style/Theme.Material.Light
android.style/Theme.Material.Light.DarkActionBar
android.style/Theme.Material.Light.NoActionBar
To support older phones we are required to provide a drawable-v21, values-v21 and layout-v21 if we want to be backward compatible.
To implement this we create our styles.xml with a Parent theme which could be thought of as an abstract class.
<resources>
<!-- Base application theme. -->
<style name="MaterialTheme" parent="ParentMaterialTheme">
<!-- Customize your theme here. -->
</style>
<style name="ParentMaterialTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Parent theme For all Pre - lollipop and lollipop above versions i.e. For all devices -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
... In the styles-v21 in the folder we then have
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MaterialTheme" parent="ParentMaterialTheme">
<!-- Customize for only Lollipop and above versions such as Marshmallow device features -->
</style>
</resources>
Colors
- Primary
- Primary Dark
- Accent