Example usage for android.content.res ColorStateList isStateful

List of usage examples for android.content.res ColorStateList isStateful

Introduction

In this page you can find the example usage for android.content.res ColorStateList isStateful.

Prototype

@Override
public boolean isStateful() 

Source Link

Document

Indicates whether this color state list contains at least one state spec and the first spec is not empty (e.g.

Usage

From source file:am.widget.indicatortabstrip.IndicatorTabStrip.java

/**
 * ??/*from w  w  w .  j  a v a  2  s.c  o  m*/
 *
 * @param gradient ??
 */
public void setGradient(ColorStateList gradient) {
    if (gradient == null) {
        mGradient = null;
        invalidate();
    } else if (mGradient != gradient && gradient.isStateful()) {
        mGradient = gradient;
        invalidate();
    } else {
        setItemBackground(new ColorDrawable(gradient.getDefaultColor()));
    }
}