Material Design(四)
来源:互联网 发布:linux c debug 编辑:程序博客网 时间:2024/06/05 15:27
Views and Shadows
View的高度决定了它的影子的大小:观点与投更大的阴影更高的Z值。浏览次数只有投射阴影下的正投影在Z = 0平面(的意见不具有可扩展的的Z值不同)。
海拔也很有创建动画执行某些行动时,其中的小部件暂时超越视图平面。
View Elevation
一个视图中的Z值有两个组成部分,elevation and translation。elevation静态组件,translation用于动画:
Z = elevation + translationZ
要设置一个视图的海拔:
- 在布局定义,使用
属性。android:elevation
- 在一个活动的代码,使用
View.setElevation
方法。
要设置视图的转换,使用View.setTranslationZ
方法。
新ViewPropertyAnimator.z
和ViewPropertyAnimator.translationZ
方法使您能够轻松地制作动画的意见高程。欲了解更多信息,请参阅API参考ViewPropertyAnimator
和Property Animation开发人员指南。
该Z值是相同的单位测量的X和Y值。
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
方法。
由于剪裁的意见是昂贵的操作,没有动画效果使用夹视图的形状。为了达到这个效果,请使用Reveal Effect的动画。
- Material Design(四)
- Material Design(四)
- 开源集锦(四)Material design
- Material Design控件使用(四)
- Android:Material Design(四) UI控件
- Android5.X (四) : Material Design-动画效果
- Android Material Design学习之四CardView
- Material Design (四),AppBarLayout的使用
- Material Design学习总结(四)
- 开源集锦(四)Material design
- Material Design (四) TabLayout的使用
- Material Design 之布局(四)
- Material Design控件使用(四)
- MaterialDesign-Material Design动画效果(四)
- Material Design
- Material Design
- Material Design
- Material Design
- 进程间通讯方式笔记
- struts2返回到JSP页面的html字符串如何在JSP页面上解析成html标签 (ognl表达式)
- CSS3 Gradient
- scp的prompt为啥隐藏不掉
- 女子支持父亲与丈夫一起变性 三人成闺密
- Material Design(四)
- poj1163_The Triangle
- 使用mysqlbinlog工具进行基于位置或时间点的数据恢复
- android Installation error: INSTALL_FAILED_CONTAINER_ERROR
- 用宏实现 C++ Singleton 模式
- Python!Are you kidding me?
- POJ 2485 Highways
- Writing module .info files (Drupal 7.x)
- win7 64位下如何安装配置mysql-5.7.4-m14-winx64