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);
    }
上一篇下一篇

猜你喜欢

热点阅读