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. POJ 1041 John&#39;s trip Euler欧拉回路判定和求回路

    就是欧拉判定,判定之后就能够使用DFS求欧拉回路了.图论内容. 这里使用邻接矩阵会快非常多速度. 这类题目都是十分困难的.光是定义的记录的数组变量就会是一大堆. #include <cstdio ...

  2. Lr_debug_message,Lr_output_message,Lr_error_message,Lrd_stmt,Lrd_fetch

    今天在群里,问了 Lr_debug_message,Lr_output_message,Lr_error_message,Lrd_stmt,Lrd_fetch.下 面我整理了下Lr_debug_mes ...

  3. pip换国内源

    pip换国内源 1.国内常用源   阿里云 http://mirrors.aliyun.com/pypi/simple/   中国科技大学 https://pypi.mirrors.ustc.edu. ...

  4. 年关了,抛一个模拟ip刷票的php程序

    <?php $ip = $_GET['ip'] ? $_GET['ip'] : '1.1.1.1'; $ipArr = explode(".", $ip); $ipArr[3 ...

  5. php处理行业分类数据

    实现步骤: 1.将excel表格存储为后缀名为 .csv格式的文件: 2.将.csv格式文件导入到mysql数据库中: 3.通过条件查询将所需要的数据查出并导入另一个数据表中: 下面是一些php片段: ...

  6. 【HTML+CSS】(2)CSS Sprite雪碧图

    1. 雪碧图的使用场景 (1). 静态图片.不随用户信息的变化而变化 (2). 小图片.图片容量比較小 (3). 载入量比較大 一些大图不建议拼成雪碧图,比如淘宝站点的导航图片都是使用的雪碧图. 2. ...

  7. Linux 基础学习(第一节)

    IP地址的配置 配置临时IP地址 ifconfig etho 192.168.0.91 255.255.255.0 图形化下面配置IP地址: 重启网卡服务: shell环境配置网卡信息 必备的参数 关 ...

  8. c++ 返回对象的引用要小心

    除非能保证返回对象的生命周期足够长. 一定不要返回临时对象的引用.

  9. atitit.系统托盘图标的设计java swing c# .net c++ js

    atitit.系统托盘图标的实现java swing c# .net c++ js 1. 系统托盘图标的结构 1 2. Java swing的实现 1 3. .net的实现 1 4. C++的实现 1 ...

  10. error: Semantic Issue: Interface type cannot be statically allocated

    转自:http://hongmin118.iteye.com/blog/1333524 error: Semantic Issue: Interface type cannot be statical ...