XScale vs XDelta in android animation

Viewed 235

Am confused with XScale and XDelta

android:fromXDelta="0%p"

vs

android:fromXScale="1.0"

what are the core differences between them

1 Answers

XScale comes inside <scale> tag it is a resizing animation.

The below code is a slide down animation

  <scale
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="0.0"
        android:toXScale="1.0"
        android:toYScale="1.0" />

Where,

XDelta comes inside <translate> tag its is for vertical and/or horizontal motion its supports the following attributes in any of the following three formats: values from -100 to 100 ending with "%", indicating a percentage relative to itself; values from -100 to 100 ending in "%p", indicating a percentage relative to its parent; a float value with no suffix, indicating an absolute value.

The code below is a animation to move from origin to right

<translate
        android:fromXDelta="0%p"
        android:toXDelta="75%p"
        android:duration="800" />
Related