我正在尝试找出如何在 2 个片段之间创建翻转动画。
我曾尝试将CardFlip培训作为指导,但似乎无法实现。我正在使用android支持包并将其设置为补间动画,但不成功。
如何实现片段之间的翻转动画?
这是我从指南创建的前 2 个 xml,也许你可以看看我做错了什么。screen_flip_left_in.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Before rotating, immediately set the alpha to 0. -->
<alpha
android:valueFrom="1.0"
android:valueTo="0.0"
android:propertyName="alpha"
android:duration="0" />
<!-- Rotate. -->
<rotate
android:valueFrom="-180"
android:valueTo="0"
android:propertyName="rotationY"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="@integer/card_flip_time_full"/>
<!-- Half-way through the rotation (see startOffset), set the alpha to 1. -->
<alpha
android:valueFrom="0.0"
android:valueTo="1.0"
android:propertyName="alpha"
android:startOffset="@integer/card_flip_time_half"
android:duration="1" />
</set>
screen_flip_left_out.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Rotate. -->
<rotate
android:valueFrom="0"
android:valueTo="180"
android:propertyName="rotationY"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:duration="@integer/card_flip_time_full" />
<!-- Half-way through the rotation (see startOffset), set the alpha to 0. -->
<alpha
android:valueFrom="1.0"
android:valueTo="0.0"
android:propertyName="alpha"
android:startOffset="@integer/card_flip_time_half"
android:duration="1" />
</set>