Android 动画以view中心点旋转动画

旋转180度

Animation anim =new RotateAnimation(0f, 180f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setFillAfter(true); // 设置保持动画最后的状态
anim.setDuration(500); // 设置动画时间
anim.setInterpolator(new AccelerateInterpolator()); // 设置插入器
anim.setAnimationListener(new Animation.AnimationListener() {
    @Override
    public void onAnimationStart(Animation animation) {
        Log.i("lgq", "re==logtest===onAnimationStart==");
    }

    @Override
    public void onAnimationEnd(Animation animation) {
        Log.i("lgq", "re==logtest===onAnimationEnd==" );
    }

    @Override
    public void onAnimationRepeat(Animation animation) {
        Log.i("lgq", "re==logtest===onAnimationRepeat==");
    }
});
localstatusfreeview.startAnimation(anim);


反转180度

Animation anim =new RotateAnimation(180f, 0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setFillAfter(true); // 设置保持动画最后的状态
anim.setDuration(500); // 设置动画时间
anim.setInterpolator(new AccelerateInterpolator()); // 设置插入器
localstatusfreeview.startAnimation(anim);

猜你喜欢

转载自blog.csdn.net/meixi_android/article/details/80941765