解决方案
不应该将getDrawable的值拿来当第一层Drawable, 而是先判断一下这个值的类型,
如果是TransitionDrawable, 应该获取它第二层Drawable作为我们的第一层,
这样原来的第一层Drawable就会失去到GC Roots的引用链, 从而可以被回收
Drawable oldDrawable = mShutterButton.getDrawable();
Drawable oldBitmapDrawable;
if (oldDrawable == null) {
oldBitmapDrawable = new ColorDrawable(Color.TRANSPARENT);
} else if (oldDrawable instanceof TransitionDrawable) {
oldBitmapDrawable = ((TransitionDrawable) oldDrawable).getDrawable(1);
} else {
oldBitmapDrawable = oldDrawable;
}
TransitionDrawable transitionDrawable = crossfadeDrawable(
oldBitmapDrawable,
getResources().getDrawable(resId));
mShutterButton.setImageDrawable(transitionDrawable);