I used scalX
and scalY
properties of objectAnimator
. When animation starts, I scale down window from value 0.9 to 0.5 for half of animation time. And again scale window from 0.5 to 0.9 for remaining animation time. As window size is reduced, window bounds perfectly fit inside clipping region during animation. This solved my problem. Below is the additional code in card_flip_right_out.xml
from this example
<objectAnimator
android:duration="200"
android:propertyName="scaleY"
android:valueFrom="0.9"
android:valueTo="0.5" >
</objectAnimator>
<objectAnimator
android:duration="200"
android:propertyName="scaleX"
android:valueFrom="0.9"
android:valueTo="0.5" >
</objectAnimator>
Below code added in card_flip_right_in.xml
<objectAnimator
android:duration="199"
android:propertyName="scaleY"
android:valueFrom="0.5"
android:valueTo="0.9" >
</objectAnimator>
<objectAnimator
android:duration="199"
android:propertyName="scaleX"
android:valueFrom="0.5"
android:valueTo="0.9" >
</objectAnimator>
<objectAnimator
android:duration="1"
android:propertyName="scaleY"
android:startOffset="199"
android:valueTo="1" >
</objectAnimator>
<objectAnimator
android:duration="1"
android:propertyName="scaleX"
android:startOffset="199"
android:valueTo="1" >