Android 为什么要调用verifyDrawable?

Android 为什么要调用verifyDrawable?,android,android-layout,view,android-drawable,Android,Android Layout,View,Android Drawable,有人能解释一下为什么我会调用verifyDrawable,因为它显然什么都不做。例如,我有一个视图显示它自己的可绘制内容(不确定这意味着什么:是否所有ImageView都符合条件?)。因为我的视图显示它自己的可绘制项,所以我应该在每个可绘制项上调用这个方法?但是这个方法不是一个可绘制的方法,而是一个视图方法。所以我很困惑。有人能解释一下吗?我在下面包括全部源代码 /** * If your view subclass is displaying its own Drawable objects

有人能解释一下为什么我会调用
verifyDrawable
,因为它显然什么都不做。例如,我有一个视图显示它自己的可绘制内容(不确定这意味着什么:是否所有ImageView都符合条件?)。因为我的视图显示它自己的可绘制项,所以我应该在每个可绘制项上调用这个方法?但是这个方法不是一个可绘制的方法,而是一个视图方法。所以我很困惑。有人能解释一下吗?我在下面包括全部源代码

/**
 * If your view subclass is displaying its own Drawable objects, it should
 * override this function and return true for any Drawable it is
 * displaying.  This allows animations for those drawables to be
 * scheduled.
 *
 * <p>Be sure to call through to the super class when overriding this
 * function.
 *
 * @param who The Drawable to verify.  Return true if it is one you are
 *            displaying, else return the result of calling through to the
 *            super class.
 *
 * @return boolean If true than the Drawable is being displayed in the
 *         view; else false and it is not allowed to animate.
 *
 * @see #unscheduleDrawable(android.graphics.drawable.Drawable)
 * @see #drawableStateChanged()
 */
@CallSuper
protected boolean verifyDrawable(Drawable who) {
    return who == mBackground || (mScrollCache != null && mScrollCache.scrollBar == who)
            || (mForegroundInfo != null && mForegroundInfo.mDrawable == who);
}
/**
*如果视图子类正在显示自己的可绘制对象,则它应该
*重写此函数,并为其指定的任何可绘制图形返回true
*展示。这样就可以创建这些可绘制对象的动画
*预定的。
*
*在重写该类时,一定要调用超类
*功能。
*
*@param谁可以通过Drawable进行验证。如果是一个,则返回true
*显示,否则将调用结果返回到
*超级级。
*
*@return boolean如果为true,则在
*观点;否则为false,不允许设置动画。
*
*@see#不可调度可拖动(android.graphics.drawable.drawable)
*@see#drawableStateChanged()
*/
@超级呼叫
受保护的布尔值verifyDrawable(Drawable who){
返回who==mBackground | |(mScrollCache!=null&&mScrollCache.scrollBar==who)
||(mForegroundInfo!=null&&mForegroundInfo.mDrawable==who);
}

“我应该在每个可绘图文件上调用此方法?”--根据代码注释的第一句话,您应该重写该方法。“我应该在每个可绘图文件上调用此方法?”--根据代码注释的第一句话,您应该重写该方法。