我在android中切换图像时遇到了问题。我想创建动画,当我点击图片时,他旋转360度,当他对半时,意味着180张图片打开了其他图片。图像是在imageView中,我有onClick方法。此时,当我单击图片图片时,打开其他图片,然后动画开始。当我的动画持续时间为50%时,我想要与其他人一起改变图像。这是我的rotate XML:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="100%"
android:duration="1000"
/>如何在开始动画时切换图像?这是可能的吗?
发布于 2012-03-26 17:49:43
也许可以试试这样的东西:
ImageView img = (ImageView)findViewById(R.id.XXXXXX);
img.startAnimation(a);
Animation a = AnimationUtils.loadAnimation(this, "your animation");
a.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationEnd(Animation animation)
{
// change image here img.setImage....
}
@Override
public void onAnimationStart(Animation animation){}
@Override
public void onAnimationRepeat(Animation animation){}
});但是如果你想改变这个动画的一半你应该有两个动画,
https://stackoverflow.com/questions/9869611
复制相似问题