Is possible to use an Android Animator to animate a DialogFragment entry?

和自甴很熟 提交于 2020-01-02 01:53:11

问题


I have a DialogFragment which I show() when the user clicks a button on my App.

I would like to set an animation to make a Z-axix rotation on the DialogFragment when it launches (i.e. a 3d card flip animation).

I have succesfully used the windowAnimationStyle and the following style to do simple animations (using the View Animation framework) when the DialogFragment is shown:

<style name="windowAnimationCardFlip" parent="@android:style/Animation.Dialog">
        <item name="android:windowEnterAnimation">@anim/card_flip_left_in</item>
        <item name="android:windowExitAnimation">@anim/card_flip_left_out</item>
 </style>

The problem is that the View Animation framework is (to the best of my knowledge), quite limited, and the only rotation that I'm able to do (on xml, at least) is a 2D XY rotation (I want a "3D" z axis rotation).

I tried to use the Property Animation framework (specifically an Object Animator, written in XML), but, while I'm able to achieve the effect when loading simple Fragments as described in the official android tutorials, when I try to apply that XML ObjectAnimator to the windowEnterAnimation attribute, nothing happens.

I would like to know, then, what could be happening? Is it possible to use an ObjectAnimator to animate the windowEntry event? If not, are there other solutions?

来源:https://stackoverflow.com/questions/14402382/is-possible-to-use-an-android-animator-to-animate-a-dialogfragment-entry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!