In Android, I know we can define animations via XML.
For example, scale_button_up.xml might look something like
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillBefore="true"
android:fillAfter="true"
android:fillEnabled="true">
<scale
android:duration="5000"
android:fromXScale="0.25"
android:fromYScale="0.25"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.75"
android:toYScale="0.75"/>
</set>
I was wondering what the default behaviour is for Android V21+, if android:interpolator="@android:anim/linear_interpolator" were not specified.
All *Animation classes are subclasses of Animation, and it handles setting the interpolator specified in XML attributes in its constructor. If there isn't one specified, the default AccelerateDecelerateInterpolator is set in its ensureInterpolator() method.
/**
* Gurantees that this animation has an interpolator. Will use
* a AccelerateDecelerateInterpolator is nothing else was specified.
*/
protected void ensureInterpolator() {
if (mInterpolator == null) {
mInterpolator = new AccelerateDecelerateInterpolator();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With