Problem when including an animation of a logo in android studio

1

It turns out that I am developing an app that has a Splash Screen first, to which I wanted to make the logo move from below to the center of the activity, but when debugging the application on my phone the animation is not appreciated, I have used the following code:

    Animation anim = AnimationUtils.loadAnimation(this,R.anim.move_up);
    ImageView img = (ImageView) findViewById(R.id.imageView);
    img.startAnimation(anim);

The following is from an XML in anim:     

<translate
    android:duration="900"
    android:fromYDelta="100%p"
    android:toYDelta="0"
    />

Is there any other way to make the animation? The truth is I'm a first-timer on android

    
asked by Saul Rmz 18.09.2016 в 07:20
source

1 answer

2

Good, what if you try

Create within res / anim an xml that is called rotate_mover_down

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

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

Change it with your values

and code use

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

I think the rotate does the trick there and that's why you do not go

It should work, you tell me:)

    
answered by 18.09.2016 / 08:25
source