平移动画
// ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mTopTx2, View.TRANSLATION_Y,-Measure_Utils.dip2px(getContext(),20),0);
// objectAnimator.setDuration(500);
// objectAnimator.addListener(new AnimatorListenerAdapter() {
// @Override
// public void onAnimationEnd(Animator animation) {
// super.onAnimationEnd(animation);
// }
//
// @Override
// public void onAnimationStart(Animator animation) {
// super.onAnimationStart(animation);
// mTopTx2.setVisibility(View.VISIBLE);
// }
// });
// objectAnimator.start();
//缩放动画
// 以view中心为缩放点,由初始状态放大两倍
ScaleAnimation animation =new ScaleAnimation(
1.0f, 1.0f, 0f, 1.0f,
Animation.ZORDER_BOTTOM, 0.5f, Animation.ZORDER_BOTTOM, 0.5f
);
animation.setDuration(200);
animation.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mTopTx2.setVisibility(View.VISIBLE);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
mTopTx2.startAnimation(animation);
网友评论