Mark Korzhov
Mark Korzhov

Reputation: 2159

How to increase the image twice with the animation?

I want to move the image and simultaneously increase it twice. But how can I enlarge the image specifying its original dimensions as the 100%? I tried to do the following, but it doesn't work:

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator">
    <scale
        android:duration="300"
        android:fillAfter="true"
        android:fromXScale="100%p"
        android:fromYScale="100%p"
        android:toXScale="150%p"
        android:toYScale="150%p" />
    <translate
        android:duration="500"
        android:fillAfter="true"
        android:fromYDelta="0"
        android:toYDelta="-100" />
</set>

Thanks.

Upvotes: 0

Views: 72

Answers (1)

Hussein El Feky
Hussein El Feky

Reputation: 6707

Try this:

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@android:anim/linear_interpolator"
    android:fillAfter="true">
    <scale
        android:duration="300"
        android:fromXScale="100%"
        android:fromYScale="100%"
        android:toXScale="150%"
        android:toYScale="150%"
        android:pivotX="50%"
        android:pivotY="50%" />
    <translate
        android:duration="500"
        android:fromYDelta="0"
        android:toYDelta="-100" />
</set>

That should work fine. Make sure you load it in your code.

Upvotes: 1

Related Questions