64

From examples provided on the Android Developer pages I see that new Views, like the RecyclerView, are backward compatible (android.support.v7.widget.RecyclerView).

Are all the new things introduced in Material Design backward compatible (to which version)?

Mehul Joisar
  • 15,348
  • 6
  • 48
  • 57
syntagma
  • 23,346
  • 16
  • 78
  • 134
  • 4
    Not yet.. they are included in the support libraries but don't work for anything but L for now. [Link to a discussion about this](http://www.reddit.com/r/androiddev/comments/2964nb/for_those_of_you_having_problems_building_with/). – hypd09 Jun 27 '14 at 06:11

6 Answers6

49

Updating this answer as Lollipop OS is officially released with support libraries, which you can use inside your project to provide compatibility to older versions.

Support library: v7 appcompat library

This library adds support for the Action Bar user interface design pattern. This library includes support for material design user interface implementations.

If you are using Android Studio then you just need to include below dependency identifier:

com.android.support:appcompat-v7:21.0.+
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295
  • How would you then insure API compatibility? Taken from the doc link you gave: "To preserve compatibility with earlier versions of Android, check the system version at runtime before you invoke these APIs." Does it mean, from your point of view, to check programmatically before invoking APIs? Sounds like twice (or more) the work to insure a smooth experience in multiples OSes... – Jean-Philippe Murray Aug 18 '14 at 12:47
  • 1
    @Jean-PhilippeMurray yes, you'll need separate resource directories as well as runtime checks `if (Build.VERSION.SDK_INT >= 21) {` – Jacob Tabak Aug 22 '14 at 17:09
  • 1
    @Jean-PhilippeMurray of course you have to be aware of API level differences. That is half the fun of Android development. The new Themes just add even more fun and excitement. Cant wait! – Glenn Bech Sep 11 '14 at 07:43
  • 5
    ^ I don't know if @GlennBech is trolling or being serious ;) It's NOT fun at all. :p – Martin Marconcini Oct 02 '14 at 23:46
  • 8
    Since the release of Lollipop, this answer is deprecated. – Chad Bingham Oct 18 '14 at 14:46
  • @Binghammer yes I am preparing a details to update this answer with proper steps and library! – Paresh Mayani Oct 20 '14 at 05:08
31

Material Design from Android 2.2 (API 8) to present 5.0 (API 21)

Here is what you need:

  1. Toolbar
  2. Material Design Library for widgets (buttons, checkboxes, etc)

1. Toolbar

Just get the idea and you ready to go.

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?attr/colorPrimaryDark"/>

Setup guide: http://antonioleiva.com/material-design-everywhere/

Source with example: https://github.com/antoniolg/MaterialEverywhere

To make Toolbar work lower API 11 use Theme.AppCompat.Light.NoActionBar (instead windowActionBar set to false)

<style name="NoActionBarTheme" parent="Theme.AppCompat.Light.NoActionBar">
     ...
</style>

2. Material Design Library

Here is Material Design Library for pretty buttons, etc..

Guide, code, example - https://github.com/navasmdc/MaterialDesignLibrary

Guide how to add library to Android Studio 1.0 - How do I import material design library to Android Studio?

.

Happy coding ;)

Inoy
  • 1,065
  • 1
  • 17
  • 24
  • 1
    This is a better and more useful answer; not sure if the accepted answer can be changed when a better one comes along. – rfay Apr 14 '15 at 21:10
10

Officialy the Material Design is backwards to the v7 appcompat Support Library.

TooCool
  • 10,598
  • 15
  • 60
  • 85
4

Just to add on to Paresh's answer, not all the features of Material Design are available on older releases. Custom themes and activity transitions are only available for APIs > 21, however as others mentioned some of the features are available in support library.

https://developer.android.com/training/material/compatibility.html

Androidme
  • 3,145
  • 3
  • 24
  • 27
1

The API is included since version 22. You need include this dependency in to gradle dependency:

com.android.support:design:22.2.0

hd1
  • 33,938
  • 5
  • 80
  • 91
Liberathor
  • 29
  • 6
0

Google design support library introduced in I/O 2015

http://android-developers.blogspot.gr/2015/05/android-design-support-library.html

You will find a lot of good stuff for material design there.

  • Navigation View
  • Snackbar
  • Floating Action Button
  • CoordinatorLayout, motion, and scrolling (the best part wich include parallax effect and pinned toolbars)

and much more ...

georgeok
  • 5,321
  • 2
  • 39
  • 61