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. Openerp开发进销存系统完毕总结

      转自:http://blog.csdn.net/heartrude/article/details/9142463 安装Openoffice 在openoffice中安装openerp repor ...

  2. iOS10相册相机闪退bug

    iOS10系统下调用系统相册.相机功能,遇到闪退的情况,描述如下: This app has crashed because it attempted to access privacy-sensit ...

  3. ADB 高级应用

    一.利用无线来查看adb shell > adb tcpip 5555   连接: > adb connect IP:5555   见后文<调试注意事项>   二.模拟按键   ...

  4. NoSQL(四)

    mongodb介绍 https://www.yiibai.com/mongodb/mongodb_drop_collection.html 1.文档性数据库类似于json对象,分布式 mongodb安 ...

  5. html5-canvas绘图操作方法

    <script>function draw(){    var c=document.getElementById("mycanvas");    c.width=50 ...

  6. 转 OAuth 2.0授权协议详解

    http://www.jb51.net/article/54948.htm 作者:阮一峰 字体:[增加 减小] 类型:转载 时间:2014-09-10我要评论 这篇文章主要介绍了OAuth 2.0授权 ...

  7. spine findBone

    spBone* bone=skeletonAnimationNode->findBone("boneName"); CCPoint boneWorldPos=ccp(bone ...

  8. 解决Ubuntu下博通网卡驱动问题

    sudo apt-get install bcmwl-kernel-source我的无线网卡是BCM4312 802.11b/g 在12.04 会集成驱动,装完就能用,现在用14.04,16.04里面 ...

  9. 二次开发第N天。。。。。。。。自动分页问题

    phpcms\modules\content\fields\pages\form.inc.php 注意修改时,如果是gbk版本可以直接用记事本修改保存!如果是utf8 要用工具修改,或者保存的时候要记 ...

  10. FileStream常用的属性和方法 (转)

    对流进行操作时要引用 using System.IO; 命名空间 FileStream常用的属性和方法: 属性: CanRead 判断当前流是否支持读取,返回bool值,True表示可以读取 CanW ...