Android:在android中使用XML进行动画的翻转动画 [英] Android: Flip Animation using XML for animation in android
问题描述
为了在网上搜索,我发现有 ViewFlipper 类可以在两个视图之间提供翻转视图动画/但是应该在同一个活动中.我也知道 Flip 动画不支持活动更改.因为现在 android 仅支持 Activity 更改期间的 2d 动画.
For searching on net i found that there is ViewFlipper class that gives the Flip view animation between two view/ But for that should be in the same Activity. I also know that the Flip animation is not suported for the activity change. as right now android support only 2d animation during activity change.
我想要的是改变活动的效果.
I want is the make the same effect for changing the activity.
那么是否有任何类似的 xml 动画可以产生像 FLip View 这样的效果,所以我将其提供给我的 Activity 更改并为 Activity 更改获得此类 Flip 效果.
So is there any similar like xml animation that gives effect as like FLip View so i provide that to my activity change and get the Such Flip effect for the Activity change.
请为我提供一些动画 xml,使 Flip 类型动画适用于活动更改.
Please provide me some xml for animation that gives the Flip type animation tht works for activity change.
谢谢.
推荐答案
试试这个
overridePendingTransition(R.anim.grow_from_middle,R.anim.shrink_to_middle);
grow_from_middle.xml
grow_from_middle.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:interpolator="@android:anim/linear_interpolator"
android:fromXScale="0.0"
android:toXScale="1.0"
android:fromYScale="0.7"
android:toYScale="1.0"
android:fillAfter="false"
android:startOffset="200"
android:duration="200" />
<translate
android:fromXDelta="50%"
android:toXDelta="0"
android:startOffset="200"
android:duration="200"/>
</set>
shrink_to_middle.xml
shrink_to_middle.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<scale
android:interpolator="@android:anim/linear_interpolator"
android:fromXScale="1.0"
android:toXScale="0.0"
android:fromYScale="1.0"
android:toYScale="0.7"
android:fillAfter="false"
android:duration="200" />
<translate
android:fromXDelta="0"
android:toXDelta="50%"
android:duration="200"/>
</set>
这篇关于Android:在android中使用XML进行动画的翻转动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!