Views and Shadows:

  elevation是构成控件阴影的基本属性。通过设置较高的Z值可以接受更大的阴影,阴影只能投射到Z=0的平面上。

View Elevation

  控件的Z值,是由两个值组成的:高度和位移。高度是固有的属性,位移可以用于创建动画。

  Z = elevation + translationZ

  改变elevation的方法:

  • 在布局中通过属性改变:android:elevation
  • 在代码中改变属性:View.setElevation

  新的 ViewPropertyAnimator.z 和 ViewPropertyAnimator.translationZ方法可以让你很简单的

为控件创建一些动画。

Shadows and Outlines

  控件背景图的边缘,会默认作为这个控件的阴影。Outlines 会根据控件的形状来生成阴影,并生成触摸反馈效果。

  用于控件的背景图,也会用于生成阴影图。

  下面是一个例子:

<TextView
android:id="@+id/myview"
...
android:elevation="2dp"
android:background="@drawable/myrect" />

  背景图:

<!-- res/drawable/myrect.xml -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#42000000" />
<corners android:radius="5dp" />
</shape>

  可以在代码中通过View.setOutline方法设置阴影图片

Clipping Views

  通过 View.setClipToOutline方法可以可以裁剪控件的轮廓。只支持矩形,圆形和椭圆。可以通过 Outline.canClip方法来检测是否支持裁剪。

  通过 View.setClipToOutline裁剪的图片设置为控件的阴影图片。

Material design之Views and Shadows的更多相关文章

  1. Material Design系列第四篇——Defining Shadows and Clipping Views

    Defining Shadows and Clipping Views This lesson teaches you to Assign Elevation to Your Views Custom ...

  2. Android Material Design-Creating Apps with Material Design(用 Material Design设计App)-(零)

    转载请注明出处:http://blog.csdn.net/bbld_/article/details/40400031 翻译自:http://developer.android.com/trainin ...

  3. Material Design系列第二篇——Getting Started

    Getting Started This lesson teaches you to Apply the Material Theme Design Your Layouts Specify Elev ...

  4. Material Design系列第一篇——Creating Apps with Material Design

    Creating Apps with Material Design //创建Material Design的App Material design is a comprehensive guide ...

  5. Material Design系列第八篇——Creating Lists and Cards

    Creating Lists and Cards //创建列表和卡片 To create complex lists and cards with material design styles in ...

  6. Material Design Get Started

    使用Material Design设计应用: Take a look at the material design specification. Apply the material theme to ...

  7. Android Material Design 兼容库的使用

    Android Material Design 兼容库的使用 mecury 前言:近来学习了Android Material Design 兼容库,为了把这个弄懂,才有了这篇博客,这里先推荐两篇博客: ...

  8. Material Design学习笔记

    Wiki->移动开发->Android->Material Design-原质化设计 (友情链接:http://wiki.jikexueyuan.com/project/materi ...

  9. ANDROID L——Material Design详解(UI控件)

    转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! Android L: Google已经确认Android L就是Android Lolli ...

随机推荐

  1. JavaScript | JQuery插件定义方法

    参考 http://www.2cto.com/kf/201507/417874.html ——————————————————————————————————————————————————————— ...

  2. Manual close is not allowed over a Spring managed SqlSession(转)

    最近用junit测试spring项目的时候,报错: Manual close is not allowed over a Spring managed SqlSession 意思是不允许手动关闭spr ...

  3. 如何为Drupal缓存对象指定缓存类?

    什么意思?意思是说,假如你有这样的需求,需要将cache_page缓存到数据库,其它的都缓存到memcache,这该怎么办? 看看_cache_get_object()的实现你就会知道上面的问题该怎么 ...

  4. .NET Remoting 入门实例

    1.创建服务端Class:ProxyServerRemoting using System; using System.Collections.Generic; using System.Text; ...

  5. Linux命令-网络命令:mail

    root用户发送邮件 mail wangyunpeng 给wangyunpeng发送邮件,wangyunpeng不在线也可以收到发送的邮件 wangyunpeng用户接收邮件 mail 接收邮件 he ...

  6. 在云服务器上部署node.js服务器

    本文档介绍腾讯云·万象优图服务端nodejs的部署和集成,搭建一个nodejs+nginx为基础,对web端或者移动端提供http签名接口服务的例子程序.注意:本文档只是简单的示例,展示了服务端为终端 ...

  7. Android数据格式解析对象JSON用法

    1.JSON概念: 一种轻量级的数据交换格式,具有良好的可读和便于快速编写的特性,从而可以在不同平台间进行数据交换.JSON采用兼容性很高的文本格式,同时也具备类似于C语言体系的行为. JSON可以将 ...

  8. Python处理验证码第一篇(pytesser初探及报错处理)

    (原文链接:http://blog.csdn.net/Bone_ACE/article/details/50436587) 前言: 春节期间,无法全身心投入地去写爬虫,那就玩玩验证码吧,应该比较有趣! ...

  9. PadLeft函数

    string num=12 num.PadLeft(4, '0'); //结果为为 '0012' 看字符串长度是否满足4位,不满足则在字符串左边以"0"补足

  10. 安装inkscape for mac注意事项

    今天为了安装inkscape for mac,搞了一下午.按以前的方法,先安最新的XQuartz,再安最新的inkscape,在运行inkscape前先打开XQuartz.但是发现不行了,inksca ...