这两种实现有什么区别?
DrawableCompat.setTintMode(wrappedDrawable, Mode.SRC_ATOP);
DrawableCompat.setTint(wrappedDrawable, color);
和
drawable.setColorFilter(color, Mode.SRC_ATOP);
最佳答案
setTint
将特定wrapedDrawable 的色调设置为int
,而setTintMode
将特定wrapedDrawable 的色调设置为 ColorStateList
类型。
drawable.setColorFilter
设置颜色过滤器,但该方法不一定向后兼容。
关于android - DrawableCompat.setTint(drawable, color) vs Drawable.setColorFilter(color, mode),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30377762/