Android image animation for splash screen

2019-06-05 12:08发布

问题:

Hi i am pretty new to android application .now i am creating one m-commerce android application.so i want to create one splash screen with animation,Its like the gift boxes will fall from top to bottom of the activity with rotation functionality.please help me out

Advance thanks

回答1:

create animation resource file named rotate_move_down.xml inside res/anim directory

<set xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true">
    <!-- Rotate -->
    <rotate
        android:duration="1200"
        android:fromDegrees="0"
        android:interpolator="@android:anim/linear_interpolator"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toDegrees="360" />

    <!--  down move -->
    <translate
        android:duration="1500"
        android:fromYDelta="0%p"
        android:interpolator="@android:anim/linear_interpolator"
        android:toYDelta="80%p" />
</set>

and use this animation to the splash activity like this .

 Animation animation= AnimationUtils.loadAnimation(MainActivity.this,R.anim.rotate_move_down);
imageView.startAnimation(animation);

imageView in your xml file.