图片着色

getBackground().setColorFilter(0xFFFF0000, PorterDuff.Mode.SRC_IN);
invalidate();
getBackground().clearColorFilter();
invalidate();

Drawable drawable=tintDrawable(originBitmapDrawable, ColorStateList.valueOf(Color.GREEN));
public static Drawable tintDrawable(Drawable drawable, ColorStateList colors) {
        final Drawable wrappedDrawable = DrawableCompat.wrap(drawable);
        DrawableCompat.setTintList(wrappedDrawable, colors);
        return wrappedDrawable;
    }

你可能感兴趣的:(图片着色)