我想用两种不同的动画创建某种 imageGallery。单击当前可见的图像时,“OK-Image”将淡入(1秒,不重复),动画完成后,应显示下一个图像
每个图像都有一个无限重复的动画(普通视图、缩放视图)
所以 ..
- 第 1 步:图像的无限动画(正常 => 缩放 => 正常..)
- 第 2 步:点击
- 第 3 步:显示“OK-Image”(在 1 秒内淡入)
- 步骤1 ...
问题是,OK-Animation 的 Animation Listener 被击中,而无限动画的 AnimationListener 没有..
@Override
public void onCreate(Bundle savedInstanceState) {
fadeInOKAnimation = AnimationUtils.loadAnimation(this, R.anim.fadeinonce);
fadePermanentAnimation = AnimationUtils.loadAnimation(this, R.anim.fadeininfinite);
fadeInOKAnimation.setAnimationListener(fadeInOKAnimationListener);
fadePermanentAnimation.setAnimationListener(fadePermanentAnimationListener);
}
AnimationListener fadeInOKAnimationListener = new Animation.AnimationListener() {
public void onAnimationEnd(Animation animation)
{
ThreadHelper.sleep(500);
imgMessung.clearAnimation();
int currentImageId = currentStateImage.getNormalImage();
imgMessung.clearAnimation();
imgMessung.setImageResource(currentImageId);
imgMessung.startAnimation(fadePermanentAnimation);
}
public void onAnimationRepeat(Animation animation) { }
public void onAnimationStart(Animation animation) { }
};
AnimationListener fadePermanentAnimationListener = new Animation.AnimationListener() {
public void onAnimationEnd(Animation animation) { }
public void onAnimationRepeat(Animation animation) {
StateImage currentStateImage = messung.GetCurrentImage();
if(currentImageState == ImageState.Normal)
{
int currentImageId = Integer.parseInt(currentStateImage.getNormalImage());
imgMessung.setImageResource(currentImageId);
}
else
{
int currentImageId = Integer.parseInt(currentStateImage.getZoomedImage());
imgMessung.setImageResource(currentImageId);
}
}
public void onAnimationStart(Animation animation) { }
};