美文网首页
Android DrawableCompat 着色

Android DrawableCompat 着色

作者: yunhen | 来源:发表于2018-08-14 15:19 被阅读76次
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);
    }

相关文章

网友评论

      本文标题:Android DrawableCompat 着色

      本文链接:https://www.haomeiwen.com/subject/fbrvbftx.html