Example usage for android.graphics.drawable GradientDrawable setColorFilter

List of usage examples for android.graphics.drawable GradientDrawable setColorFilter

Introduction

In this page you can find the example usage for android.graphics.drawable GradientDrawable setColorFilter.

Prototype

@Override
    public void setColorFilter(@Nullable ColorFilter colorFilter) 

Source Link

Usage

From source file:Main.java

private static Drawable getSelectedDrawable(GradientDrawable mDrawable) {
    GradientDrawable gradientDrawable = (GradientDrawable) mDrawable.getConstantState().newDrawable();
    gradientDrawable.mutate();/* w  ww  .  j av a  2s  .c o  m*/
    gradientDrawable.setColorFilter(new ColorMatrixColorFilter(new ColorMatrix(new float[] { 1, 0, 0, 0,
            -DRAW_DEEP, 0, 1, 0, 0, -DRAW_DEEP, 0, 0, 1, 0, -DRAW_DEEP, 0, 0, 0, 1, 0 })));
    return gradientDrawable;
}