旋转动画

来源:互联网 发布:哪款root软件最好 编辑:程序博客网 时间:2024/04/29 17:55
private RotateAnimation animation;          //旋转动画

private RotateAnimation reverseAnimation;   //旋转动画


animation = new RotateAnimation(0, -180,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
animation.setInterpolator(new LinearInterpolator());
animation.setDuration(250);
animation.setFillAfter(true);

reverseAnimation = new RotateAnimation(-180, 0,
RotateAnimation.RELATIVE_TO_SELF, 0.5f,
RotateAnimation.RELATIVE_TO_SELF, 0.5f);
//动画速度
reverseAnimation.setInterpolator(new LinearInterpolator());
//持续时间
reverseAnimation.setDuration(200);
reverseAnimation.setFillAfter(true); //保留在终止位置


private ImageView arrowImageView;

arrowImageView.clearAnimation();

arrowImageView = (ImageView) headView.findViewById(R.id.head_arrowImageView);
arrowImageView.setMinimumWidth(70);
arrowImageView.setMinimumHeight(50);
arrowImageView.startAnimation(animation);

0 0
原创粉丝点击