美文网首页
使用ObjectAnimator实现向上向下展开

使用ObjectAnimator实现向上向下展开

作者: JianLee | 来源:发表于2017-04-17 00:34 被阅读129次
 private void openView(){
        int winh=DensityUtil.getScreenH(this);//获取整个界面高度
        ObjectAnimator animator=ObjectAnimator.ofFloat(imgView,"scaleY",1,winh);
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                imgView.setBackgroundColor(getResources().getColor(R.color.white));
            }

            @Override
            public void onAnimationEnd(Animator animation) {
            }
        });
        animator.setStartDelay(300);//设置动画延迟执行
        animator.setDuration(10000);//设置动画时间
        animator.start();
    }

相关文章

网友评论

      本文标题:使用ObjectAnimator实现向上向下展开

      本文链接:https://www.haomeiwen.com/subject/hopzattx.html