这两种实现之间有什么区别?

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


drawable.setColorFilter(color, Mode.SRC_ATOP);

最佳答案

setTint将特定wrappedDrawable的色彩设置为int,而setTintMode将特定wrappedDrawable的色彩设置为ColorStateList类型。
drawable.setColorFilter设置一个滤色器,但是该方法不一定向后兼容。

09-11 06:13