Lollipop(5.0)一览

1、Material theme


You can configure your app to use the material theme on devices that support it and revert to an older theme on devices running earlier versions of Android:
Define a theme that inherits from an older theme (like Holo) in res/values/styles.xml.
Define a theme with the same name that inherits from the material theme in res/values-v21/styles.xml.
Set this theme as your app’s theme in the manifest file.
Note: If your app uses the material theme but does not provide an alternative theme in this manner, your app will not run on versions of Android earlier than 5.0.

定义样式的时候,可以定义分别在 values/styles.xml 和 values-v21/styles.xml 定义一个相同名字的样式,供系统自动选择。
说明 material theme 仅在 5.0 有效。

2、Activity 的过渡和退出动画


Android 5.0 (API level 21) includes new APIs to create custom animations in your app. For example, you can enable activity transitions and define an exit transition inside an activity

同样地,Activity 的过渡和退出动画只有 5.0 支持。

3、Customize the Status Bar


To set a custom color for the status bar, use the android:statusBarColor attribute when you extend the material theme.

又是只给 5.0 用。

4、Lists and Cards


终于有用到 v7 兼容包的了。RecyclerView 和 CardView 坚持到 Android 2.1 (API level 7)。

使用详情:http://developer.android.com/training/material/lists-cards.html

答应了馥馥,明天起,早早就要洗白白,早早就睡觉。答应了就做到!做不到是小狗!


继续写


5、Working with Drawables


1、Tint Drawable Resources

With Android 5.0 (API level 21) and above, you can tint bitmaps and nine-patches defined as alpha masks. You can tint them with color resources or theme attributes that resolve to color resources (for example, ?android:attr/colorPrimary). Usually, you create these assets only once and color them automatically to match your theme.

给资源着色,自动适配主题,又是 5.0 以上。

2、Extract Prominent Colors from an Image

The Android Support Library r21 and above includes the Palette class, which lets you extract prominent colors from an image.

提取 image 的主要颜色,这个在 r21 的 v7 支持。

dependencies {

compile ‘com.android.support:palette-v7:21.0.+’
}

3、Create Vector Drawables


In Android 5.0 (API Level 21) and above, you can define vector drawables, which scale without losing definition. You need only one asset file for a vector image, as opposed to an asset file for each screen density in the case of bitmap images.

创建矢量图片。又是 5.0 以上!

6、Defining Custom Animations


最期待的动画!!全都是 Android 5.0 (API level 21) and above。

7、Maintaining Compatibility


1、定义可供选择的 style
2、提供可选择的 layout
3、使用 Support Library
这些是 v7 r21 支持的:

The RecyclerView widget to display data collections.
The CardView widget to create cards.
The Palette class to extract prominent colors from images.

还有小部分系统控件:

EditText
Spinner
CheckBox
RadioButton
SwitchCompat
CheckedTextView

4、用代码检测系统版本

1
2
3
4
5
6
// Check if we're running on Android 5.0 or higher
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    // Call some material design APIs here
} else {
    // Implement this feature without material design
}

以下的新特性只有在 5.0(API level 21) 及以上的提供:

Activity transitions
Touch feedback
Reveal animations
Path-based animations
Vector drawables
Drawable tinting


Android 5.0 (LOLLIPOP) 新特性一览小笔记。

参考:Android Training 的 Creating Apps with Material Design

突然发现还有Toolbar 等没有提及。再推荐两篇安卓大神写的material design 好文看看:

appcompat v21: material design for pre-Lollipop devices!

Material Design Everywhere: Using AppCompat 21