下面列出了android.view.animation.RotateAnimation#setFillBefore() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
InnerRefreshIconObserver(ImageView refreshIcon, int refreshPosition) {
this.refreshIcon = refreshIcon;
this.refreshPosition = refreshPosition;
viewOffsetHelper = new ViewOffsetHelper(refreshIcon);
rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setDuration(1000);
rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setRepeatCount(Animation.INFINITE);
rotateAnimation.setFillBefore(true);
}
private Animation getRotateAnimation() {
RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f,
getWidth() / 2, getHeight() / 2);
rotateAnimation.setDuration(2000);
rotateAnimation.setRepeatCount(1);
rotateAnimation.setFillAfter(true);
rotateAnimation.setFillBefore(false);
rotateAnimation.setRepeatMode(Animation.REVERSE);
return rotateAnimation;
}
private Animation getRotateAnimation() {
RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f,
getWidth() / 2, getHeight() / 2);
rotateAnimation.setDuration(2000);
rotateAnimation.setRepeatCount(1);
rotateAnimation.setFillAfter(true);
rotateAnimation.setFillBefore(false);
rotateAnimation.setRepeatMode(Animation.REVERSE);
return rotateAnimation;
}