1
我想对我的图像做一个多动画(出现 - >旋转 - >消失)。我有这样的代码:动画出现,旋转和消失
fade_in.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:shareInterpolator="false" >
<alpha
android:duration="1"
android:fromAlpha="0"
android:toAlpha="100" />
</set>
fade_out.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:shareInterpolator="false" >
<alpha
android:duration="1"
android:fromAlpha="100"
android:toAlpha="0" />
</set>
image_rotate.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true"
android:shareInterpolator="false" >
<rotate
android:duration="2500"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="120" />
</set>
在我的Java代码
另外:
animRotate= AnimationUtils.loadAnimation(context, R.anim.image_rotate);
animRotate.setDuration((long) duration);
fade_in = AnimationUtils.loadAnimation(context, R.anim.fade_in);
fade_out = AnimationUtils.loadAnimation(context, R.anim.fade_out);
AnimationSet s = new AnimationSet(false);
s.addAnimation(fade_in);
s.addAnimation(animRotate);
s.addAnimation(fade_out);
image.startAnimation(s);
但不幸的是它不能正常工作...
不correcrly工作? – pskink