Animator animator = ViewAnimationUtils.createCircularReveal(btn2, btn2.getWidth() / 2, btn2.getHeight() / 2, 0, btn2.getHeight()); animator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animator) { super.onAnimationStart(animator); Log.d(TAG, "onAnimationStart"); btn2.setVisibility(View.VISIBLE); } @Override public void onAnimationResume(Animator animation) { super.onAnimationResume(animation); Log.d(TAG, "onAnimationResume"); } @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); Log.d(TAG, "onAnimationEnd"); } @Override public void onAnimationPause(Animator animation) { super.onAnimationPause(animation); Log.d(TAG, "onAnimationPause"); } }); animator.setInterpolator(new LinearInterpolator()); animator.setDuration(3000); animator.start(); }
btn2这个view从无到有 以 btn2.getWidth() / 2 和 btn2.getHeight() / 2为圆心,初始半径为 0 终止半径为 btn2.getHeight()展示出来
需要注意的一点: btn2一定要设置成invisible而不能设置为gone