I have made animation through xml like rotation animation which is to be used for activity transition. the first part is the rotate and scale animation which work togather to show half rotation the work fine but when i add reverse of them with start offset they are showing blank view instead of animation… not showing even the first part of animation which was working correctly..
Here is xml code when only first part was there and it is working correctly..
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<rotate
android:duration="2000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="-15"
android:toYScale="0.0" />
<scale
android:duration="2000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0"
android:toYScale="1" />
</set>
but when i add reverse code it just goes blank all the time…
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<rotate
android:duration="2000"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="-15"
android:toYScale="0.0" />
<scale
android:duration="2000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0"
android:toYScale="1" />
<rotate
android:startOffset="2000"
android:duration="2000"
android:fromDegrees="-15"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0"
android:toYScale="0.0" />
<scale
android:startOffset="2000"
android:duration="2000"
android:fromXScale="0"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="1"
android:toYScale="1" />
</set>
so guys please tell me where i’m going wrong…
You don’t need to dublicate your animations to achieve reverse effect. You can use android:repeateMode = “reverse” and android:repeatCount = “1”
You need to set
repeatCountandrepeatModeboth forscaleandrotateanimations. Unfortunately you can’t just use it directly insetattribute due bug inAnimationSetimplementation.But this animation will be applied only on one activity. If you actually want the first activity to disappear and then the second activity to appear you need to split your animation into two pieces. The first part will have your
rotateandscaledirect animations and the second part will have reversedrotateandscaleanimation. So basically just you need to split yoursetwith four animation into two files. Then you need to use this two animations for starting new activity: