Material Design backward compatibility

こ雲淡風輕ζ 提交于 2019-11-27 17:14:33

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.+

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 ;)

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

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

Liberathor

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

com.android.support:design:22.2.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 ...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!