DrawableCompat.setTint(可绘制,颜色)与Drawable.setColorFilter(颜色,模式)

时间:2015-05-21 15:13:55

标签: android drawable android-appcompat porter-duff

这两种实现有什么区别?

DrawableCompat.setTintMode(wrappedDrawable, Mode.SRC_ATOP);
DrawableCompat.setTint(wrappedDrawable, color);

drawable.setColorFilter(color, Mode.SRC_ATOP);

1 个答案:

答案 0 :(得分:0)

setTint将特定wrapedDrawable的色调设置为int,而setTintMode将特定wrappedDrawable的色调设置为ColorStateList类型。

drawable.setColorFilter设置了一个滤镜,但该方法不一定向后兼容。

相关问题