缩小动画闪屏的安卓?
问题描述:
我有一个要求中,我不得不放弃缩小在启动画面效果。请推荐一些东西。我有一个我们能够保持它的动画RES /动画文件夹,并用它在活动的想法。
I have a requirement in which i have to give zoom out effect in splash screen. Please Suggest something. I have an idea that we can keep its animation in res/anim folder and use it in activity.
答
在活动的Java文件使用这样的:
Use this in Activity Java File :
FrameLayout mainFrame = ((FrameLayout) findViewById(R.id.FrameLayout01));
Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(this,
R.anim.hyperspace_jump);
mainFrame.startAnimation(hyperspaceJumpAnimation);
将在资源这个code>动画> hyperspace_jump.xml
Put this code under res > anim > hyperspace_jump.xml
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false">
<scale
android:interpolator="@android:anim/accelerate_decelerate_interpolator"
android:fromXScale="0.0"
android:toXScale="1.4"
android:fromYScale="0.0"
android:toYScale="1.4"
android:pivotX="50%"
android:pivotY="50%"
android:fillAfter="false"
android:duration="700" />
<set android:interpolator="@android:anim/decelerate_interpolator">
<scale
android:fromXScale="1.4"
android:toXScale="0.8"
android:fromYScale="1.4"
android:toYScale="0.8"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400"
android:fillBefore="false" />
<!-- <rotate
android:fromDegrees="0"
android:toDegrees="360"
android:toYScale="0.0"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="700"
android:duration="400" />
-->
</set>
</set>