简体   繁体   English

材料设计向后兼容

[英]Material Design backward compatibility

From examples provided on the Android Developer pages I see that new Views, like the RecyclerView , are backward compatible ( android.support.v7.widget.RecyclerView ). 从Android开发人员页面上提供的示例中,我看到新视图(例如RecyclerView )向后兼容( android.support.v7.widget.RecyclerView )。

Are all the new things introduced in Material Design backward compatible (to which version)? 材料设计中引入的所有新功能是否都向后兼容(哪个版本)?

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. 随着Lollipop OS随支持库的正式发布而更新了此答案,您可以在项目内部使用该库来提供对较早版本的兼容性。

Support library: v7 appcompat library 支持库: v7 appcompat库

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: 如果您使用的是Android Studio,则只需在下面添加依赖项标识符即可:

com.android.support:appcompat-v7:21.0.+

Material Design from Android 2.2 (API 8) to present 5.0 (API 21) 从Android 2.2(API 8)到现在的5.0(API 21)的Material Design

Here is what you need: 这是您需要的:

  1. Toolbar 工具列
  2. Material Design Library for widgets ( buttons, checkboxes, etc ) 部件的材料设计库( 按钮,复选框等

1. Toolbar 1.工具栏

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/ 设置指南: http//antonioleiva.com/material-design-everywhere/

Source with example: https://github.com/antoniolg/MaterialEverywhere 带有示例的来源: https : //github.com/antoniolg/MaterialEverywhere

To make Toolbar work lower API 11 use Theme.AppCompat.Light.NoActionBar ( instead windowActionBar set to false ) 为了使Toolbar的 API 11更低,请使用Theme.AppCompat.Light.NoActionBar (将windowActionBar设置为false )。

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

2. Material Design Library 2.材料设计库

Here is Material Design Library for pretty buttons, etc.. 这是用于漂亮按钮等的Material Design库

Guide, code, example - https://github.com/navasmdc/MaterialDesignLibrary 指南,代码,示例-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? 指导如何将库添加到Android Studio 1.0- 如何将材质设计库导入Android Studio?

.

Happy coding ;) 快乐的编码;)

正式地, Material Design退回v7 appcompat支持库

Just to add on to Paresh's answer, not all the features of Material Design are available on older releases. 只是为了补充Paresh的答案,并非旧版本中提供了Material Design的所有功能。 Custom themes and activity transitions are only available for APIs > 21, however as others mentioned some of the features are available in support library. 自定义主题和活动过渡仅适用于> 21的API,但是正如其他人提到的那样,支持库中提供了某些功能。

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

The API is included since version 22. You need include this dependency in to gradle dependency: 该API自版本22起便包含在内。您需要将此依赖项包含在gradle依赖项中:

com.android.support:design:22.2.0 com.android.support:design:22.2.0

Google design support library introduced in I/O 2015 I / O 2015中引入的Google设计支持库

http://android-developers.blogspot.gr/2015/05/android-design-support-library.html 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) Coordinator布局,运动和滚动(最好的部分包括视差效果和固定的工具栏)

and much more ... 以及更多 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM