微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android:点击按钮后布局上的动画,最低SDK版本为14

在最低SDK版本14应用程序中,如何在 Android中完成与此相同的效果

enter image description here

>背景效果
>滑动切换按钮
>我的minSDKVersion是14

看起来像是在背景上放大动画的圆圈,还是有更具体的功能呢?

非常感谢…

解决方法

看看 Circular Reveal from touch point

@Override
public boolean onTouch(View view,MotionEvent motionEvent) {
    if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
        if (view.getId() == R.id.square_yellow) {
            revealFromCoordinates(motionEvent.getRawX(),motionEvent.getRawY());
        }
    }
    return false;
}

private Animator animateRevealColorFromCoordinates(int x,int y) {
    float finalRadius = (float) Math.hypot(viewRoot.getWidth(),viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot,x,y,finalRadius);
    viewRoot.setBackgroundColor(color);
    anim.start();
}

enter image description here

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐