android z轴动画,ZDepthShadowLayout

使任意View控件产生Android MaterialDesign 中的z轴阴影效果。

效果图:

9810503c0d3e9c4919f1bf826602cc60.gif

如何使用

使用很简单,只要将你想要产生阴影的View包含在即可:

android:id="@+id/zDepthShadowLayout"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

shadow:z_depth="z_depth4">

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:padding="16dp"

android:text="Change ZDepth"

android:background="@android:color/white"/>

即让TextView产生阴影

其中属性z_depth是设置阴影的大小,是个枚举值:z_depth0、z_depth1、z_depth2、z_depth3、z_depth4、z_depth5, 值越大阴影越大。你也可用java 代码设置:zDepthShadowLayout.changeZDepth(ZDepth.Depth0)

属性说明属性名称类型使用说明

z_depthenum(枚举类型)设置阴影大小,值:z_depth0、z_depth1、z_depth2、z_depth3、z_depth4、z_depth5, 值越大阴影越大

z_depth_shapeenum设置阴影形状,值:rect(矩形)、oval(椭圆形)

z_depth_paddingenum设置内间距,值:z_depth0、z_depth1、z_depth2、z_depth3、z_depth4、z_depth5, 值越大内间距越大

z_depth_paddingLeftenum设置左内间距

z_depth_paddingTopenum设置上内间距

z_depth_paddingRightenum设置右内间距

z_depth_paddingBottomenum设置下内间距

z_depth_animDurationinteger档z_depth_doAnim设置true,用于设置动画的时间

z_depth_doAnimboolean阴影是否以动画方式被设置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值