Android: Material Theme

Material design is a complete design philosophy for visual, motion, and interaction design across platforms and devices.

Android provides the following elements for you to build material design apps:

  • A new theme
  • New widgets for complex views
  • New APIs for custom shadows and animations

Android 5.0 provides three Material Theme flavors:
  • Theme.Material – Dark version of Material Theme; this is the default flavor in Android 5.0.

  • Theme.Material.Light – Light version of Material Theme.

  • Theme.Material.Light.DarkActionBar – Light version of Material Theme, but with a dark action bar.
To get started with Material design in your Android app, update your targetSdkVersion to "21" and apply the new Material theme. 

For example, when creating a custom theme for your app, open your project'sres/values/styles.xml file and extend the Material theme:

         <style name="AppTheme" parent="android:Theme.Material">
         <!-- Customize the Material elements here -->

Then apply your custom theme to your application in the manifest file:<application android:theme="@style/AppTheme">

The v7 support library has been significantly updated in revision 21 to make many of the Material design elements available when running on older versions of the platform.

The Material Theme adds 5 new color values that can be easily set in your application.

<?xml version="1.0" encoding="utf-8"?> 

<style name="AppTheme" parent="android:Theme.Material.Light"> 
<item name="android:colorPrimary">@color/primary</item> 
<item name="android:colorPrimaryDark">@color/primary_dark</item>
<item name="android:colorAccent">@color/accent</item>
<item name="android:textColorPrimary">@color/text_primary</item>
<item name="android:textColor">@color/text_secondary</item>
<item name="android:navigationBarColor">@color/primary_dark</item></style> 

No comments:

Post a Comment