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
本文介绍如何使用ViewAnimationUtils创建圆形显示动画,并通过Animator监听器控制动画的开始、暂停、恢复及结束状态。文中详细展示了如何设置动画插值器、持续时间和启动动画。
2260

被折叠的 条评论
为什么被折叠?



