What do pivotX and pivotY mean in Android animations?

srujan maddula picture srujan maddula · Oct 23, 2014 · Viewed 33.3k times · Source

These two terms occur in many places but what exactly do they mean in the context of Android animations?

Answer

Niko Adrianus Yuwono picture Niko Adrianus Yuwono · Oct 23, 2014

The pivotX and pivotY is the central point of the animation.
So for example if you want to do Zoom In animation you can use this

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:fillAfter="true" >

    <scale
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:duration="1000"
        android:fromXScale="1"
        android:fromYScale="1"
        android:pivotX="50%"
        android:pivotY="50%"
        android:toXScale="3"
        android:toYScale="3" >
    </scale>

</set>

and the android:pivotX="50%" and android:pivotY="50%" will mean the zoom will be started from the center.

There is also a nice tutorial by android hive here