Example usage for android.graphics.drawable ColorDrawable setColorFilter

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

Introduction

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

Prototype

public void setColorFilter(@ColorInt int color, @NonNull PorterDuff.Mode mode) 

Source Link

Document

Specify a color and Porter-Duff mode to be the color filter for this drawable.

Usage

From source file:despotoski.nikola.github.com.bottomnavigationlayout.Util.java

public static void setColorToColorDrawable(ColorDrawable color, int colorValue) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        color.setColor(colorValue);//w  w  w  .j a va  2 s .c  om
    } else {
        color.setColorFilter(colorValue, PorterDuff.Mode.SRC_ATOP);
    }
}