The new material design features (like the material theme and activity transitions) are only available in the Android L Developer Preview. However, you can design your apps to make use of these features when running on devices with the Android L Developer Preview and still be compatible with previous releases of Android.
The material theme is only available in the Android L Developer Preview. To configure your app to use the material theme on devices running the Android L Developer Preview and an older theme on devices running earlier versions of Android:
- Define a theme that inherits from an older theme (like Holo) in
- Define a theme with the same name that inherits from the material theme in
- Set this theme as your app's theme in the manifest file.
Note: If you do not provide an alternative theme in this manner, your app will not run on earlier versions of Android.
If the layouts that you design according to the material design guidelines do not use any of the new XML attributes from the Android L Developer Preview, they will work on previous versions of Android. Otherwise, you can provide alternative layouts. You can also provide alternative layouts to customize how your app looks on earlier versions of Android.
Create your layout files for the Android L Developer Preview inside
and your alternative layout files for earlier versions of Android inside
Alternative layouts have the same file name.
To avoid duplication of code, define your styles inside
res/values/ and modify the
res/values-v21/ for the new APIs.
CardView widgets are included in the Android L
Developer Preview Support Library, so they are available in earlier versions of Android with
CardViewfalls back to a programmatic shadow implementation using additional padding.
CardViewdoes not clip its children views that intersect with rounded corners.
These limitations do not apply to the Android L Developer Preview.
The following new APIs are only available in the Android L Developer Preview:
- Activity transitions
- Touch feedback
- Reveal animations
- Path-based animations
To preserve compatibility with earlier versions of Android, check the system version at runtime before you invoke these APIs.