Material Design动画

本文详细介绍了Material Design中的触摸反馈、揭露效果和转场动画。触摸反馈包括点击后的水波特效;揭露效果通过特定方法实现动画圆心定位;转场动画部分讲解了Activity的传统转场、ActivityOptions的多种动画实现,以及系统预设的几种动画效果。同时,文章还提到了自定义动画的实现方法,如makeCustomAnimation和makeClipRevealAnimation,并探讨了共享元素转场的细节。
摘要由CSDN通过智能技术生成

还没有完成,勿看勿看~!!!!

转载请注明:https://blog.csdn.net/feather_wch/article/details/80097833

Material Design动画

触摸反馈

1、触摸反馈(点击后水波特效)

按钮中添加属性(两种):

<Button
    xxxxxx
    android:text="有界水波纹"
    android:background="?android:attr/selectableItemBackground"/>

<Button
    xxxxxx
    android:text="无界水波纹"
    android:background="?android:attr/selectableItemBackgroundBorderless"/>

揭露效果

2、Reveal Effect实例

  1. 通过View的ViewAnimationUtils的方法
  2. 揭露效果的动画的圆心是以目标View的左上角确定坐标系的
button.post(new Runnable() {
    @Override
    public void run() {
        //圆心
        int cx = button.getWidth() / 2;
        int cy = button.getHeight() / 2;
        //最终半径
        int finalRadius = Math.max(button.getWidth(), button.getHeight());

        Animator animator = ViewAnimationUtils.createCircularReveal(button, cx, cy, 0, finalRadius);
        animator.setDuration(5000);
        animator.start();
    }
});

3、崩溃错误-解决办法:“揭露动画”需要在View被attache后调用

java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.IllegalStateException: Cannot start this animator on a detached view!
//1. The Runnable will run after the view
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

猎羽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值