zoukankan      html  css  js  c++  java
  • ViewAnimationUtils知识点

    今天看到了一个视图慢慢显示出来的动画,心生好奇,决定一探究竟,原来,实现非常简单,使用ViewAnimationUtils. createCircularReveal()方法可以实现,这个方法返回一个动画器,该动画器可以使剪贴圆具有动画效果。具体代码如下:

        final View view = findViewById(R.id.view);
        view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
            @Override
            public void onLayoutChange(View v, int left, int top, int right, int bottom,
                                       int oldLeft, int oldTop, int oldRight, int oldBottom) {
                int x = (int) (view.getWidth() / 2 );
                int y = (int) (view.getHeight() / 2 );
                // x,y 是动画圆心点
                Animator animator = ViewAnimationUtils.createCircularReveal(view, x, y,
                        0,view.getHeight());
                animator.setDuration(4000);
                animator.start();
                animator.addListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animation) { }
        
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        view.setVisibility(View.GONE);
                    }
        
                    @Override
                    public void onAnimationCancel(Animator animation) { }
        
                    @Override
                    public void onAnimationRepeat(Animator animation) { }
                });
            }
        });
  • 相关阅读:
    一次硬盘安装debian的过程
    Java热替换
    Hibernate缓存
    Java消息机制
    Hibernate批量操作(一)
    SQLite与SQL差异
    tablelayout:fixed 在一些情况下 会导至width失效。
    heiht三种浏览器的写法
    [WebMethod(EnableSession = true)]
    10分钟学会基于ASP.NET的 JQuery实例 (转)
  • 原文地址:https://www.cnblogs.com/Ayinger/p/10968773.html
Copyright © 2011-2022 走看看