Android DrawableCompat 着色
2018-08-14 本文已影响76人
yunhen
public static void imgSetRed(ImageView imgView) {
if (imgView == null) return;
WeakReference<ImageView> w = new WeakReference<>(imgView);
Drawable tintIcon = DrawableCompat.wrap(w.get().getDrawable().mutate());
DrawableCompat.setTint(tintIcon,Color.RED);
w.get().setImageDrawable(tintIcon);
}