我正在尝试制作一个动画,该动画将从当前位置滑动到屏幕中心,然后翻转。我让每个移动组件都正常工作,但是一旦我将它们全部放入带有 startoffset 的集合中,动画直到该偏移结束时才会开始,并且它会立即执行所有动画。非常感谢您对此的任何帮助。
slide_down.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Slide down -->
<translate
android:fromYDelta="0%"
android:toYDelta="100%"
android:duration="1000"/>
<!-- Set alpha to fully opaque -->
<alpha
android:fromAlpha="0.8"
android:toAlpha="1.0"
android:duration="1000" />
<!-- Flip image once it's in the center -->
<!-- ***** HERE IS THE only offset I set ****** -->
<scale
android:fromXScale="0.0"
android:toXScale="1.0"
android:pivotX="50%"
android:fromYScale="1.0"
android:toYScale="1.0"
android:startOffset="1000"
android:duration="200" />
</set>
调用代码
Animation anim = AnimationUtils.loadAnimation(getActivity(), slideDirection);
anim.setAnimationListener(new AnimationListener() {
public void onAnimationStart(Animation animation) {
}
public void onAnimationRepeat(Animation animation) {
}
public void onAnimationEnd(Animation animation) {
mCallBack.categorySelected(view.getId());
}
});
view.clearAnimation();
view.startAnimation(anim);
谢谢,德曼