Java代码修改图标的颜色

mRedDotIv.setImageDrawable(tintDrawable(mRedDotIv.getDrawable(), ColorStateList.valueOf(0xFFFF4242)));

private Drawable tintDrawable(Drawable drawable, ColorStateList colorStateList) {
        Drawable wrappedDrawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTintList(wrappedDrawable, colorStateList);
        return wrappedDrawable;
    }

你可能感兴趣的:(Java代码修改图标的颜色)