Android examples for Graphics:Drawable
set Drawable Color
//package com.java2s; import android.graphics.ColorFilter; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; public class Main { public static Drawable setColor(@NonNull Drawable drawable, int color) { final Drawable out = drawable.mutate(); out.setColorFilter(getColorFilter(color)); return out; }// ww w.j a va 2 s . com public static ColorFilter getColorFilter(int color) { return new PorterDuffColorFilter(color, PorterDuff.Mode.MULTIPLY); } }