Android Material Design 向后兼容性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24445012/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Material Design backward compatibility
提问by syntagma
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)?
Material Design 中引入的所有新东西是否都向后兼容(到哪个版本)?
采纳答案by Paresh Mayani
Updating this answer as LollipopOS is officially released with support libraries, which you can use inside your project to provide compatibility to older versions.
随着LollipopOS 正式发布支持库,您可以在项目中使用它来提供对旧版本的兼容性,因此更新此答案。
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.+
回答by Inoy
Material Design from Android 2.2 (API 8) to present 5.0 (API 21)
Material Design 从 Android 2.2 (API 8) 到现在 5.0 (API 21)
Here is what you need:
这是您需要的:
- Toolbar
- 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 Toolbarwork lower API 11use Theme.AppCompat.Light.NoActionBar(instead windowActionBar set to false)
为了使工具栏在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 Libraryfor pretty buttons, etc..
这是用于漂亮按钮等的材料设计库。
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 ;)
快乐编码;)
回答by Chulo
Officialy the Material Design
is backwards to the v7 appcompat Support Library.
官方Material Design
是向v7 appcompat Support Library倒退。
回答by Androidme
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.
只是为了补充 Paresh 的答案,并非 Material Design 的所有功能都在旧版本中可用。自定义主题和活动转换仅适用于 API > 21,但是正如其他人提到的,支持库中提供了一些功能。
https://developer.android.com/training/material/compatibility.html
https://developer.android.com/training/material/compatibility.html
回答by Liberathor
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
回答by georgeok
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)
- 导航视图
- 小吃店
- 浮动操作按钮
- CoordinatorLayout、运动和滚动(最好的部分包括视差效果和固定工具栏)
and much more ...
以及更多 ...