Reputation:
I want to animate appearing of a PopupWindow
. This is my show.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="200"
android:fromXScale="0"
android:fromYScale="0"
android:toXScale="1"
android:toYScale="0.1"
android:pivotX="90%"
android:pivotY="10%"
android:interpolator="@android:interpolator/accelerate_decelerate"/>
<scale
android:startOffset="200"
android:duration="600"
android:fromXScale="1"
android:fromYScale="0.1"
android:toXScale="1"
android:toYScale="1"
android:pivotX="90%"
android:pivotY="10%"
android:interpolator="@android:interpolator/accelerate_decelerate"/>
</set>
And styles.xml:
<style name="popup_anim">
<item name="@android:windowEnterAnimation">@anim/show</item>
</style>
finally:
mPopupWindow.setAnimationStyle(R.style.popup_anim);
As you can see, in my show.xml, I defined two animations and they should play in order by startOffset. They did well in this. However, when the second animation start to play, it stops nearly at once though its duration should be 600ms. So what is the problem? Thanks in advance!
Upvotes: 0
Views: 61
Reputation: 258
change the second scale animation's android:toYScale from 1 to 10.
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:duration="200"
android:fromXScale="0"
android:fromYScale="0"
android:toXScale="1"
android:toYScale="0.1"
android:pivotX="90%"
android:pivotY="10%"
android:interpolator="@android:interpolator/accelerate_decelerate"/>
<scale
android:startOffset="200"
android:duration="600"
android:fromXScale="1"
android:toXScale="1"
android:fromYScale="0.1"
android:toYScale="10"
android:pivotX="90%"
android:pivotY="10%"
android:interpolator="@android:interpolator/accelerate_decelerate"/</set>
Upvotes: 1