如果未指定 android:interpolator,则默认插值器是什么

What is the default interpolator if android:interpolator is unspecified

在Android中,我知道我们可以通过XML定义动画。

例如,scale_button_up.xml 可能类似于

<?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>

我想知道如果未指定 android:interpolator="@android:anim/linear_interpolator",Android V21+ 的默认行为是什么。

所有 *Animation 类 都是 Animation 的子 类,它处理在其构造函数中设置 XML 属性中指定的插值器。如果没有指定,则在其 ensureInterpolator() 方法中设置默认值 AccelerateDecelerateInterpolator

/**
* 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();
    }
}