change White Drawable - Android Graphics

Android examples for Graphics:Drawable Operation

Description

change White Drawable

Demo Code


//package com.java2s;
import android.content.Context;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;

public class Main {
    public static Drawable changeWhiteDrawable(Context context,
            Drawable drawable) {/* www  .  ja v a  2s. co m*/
        return changeDrawableColor(drawable, Color.parseColor("#FFFFFF"));
    }

    public static Drawable changeDrawableColor(Drawable drawable, int color) {
        drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
        return drawable;
    }
}

Related Tutorials