Code example for StateListDrawable

Methods: setState

0
    } 
 
    public void setState(int [] state) {
        if (mDrawable instanceof StateListDrawable) {
            StateListDrawable d = (StateListDrawable) mDrawable;
            d.setState(state);
        } 
    } 
 
    public boolean hasState(int [] state) {
        if (mDrawable instanceof StateListDrawable) {
            StateListDrawable d = (StateListDrawable) mDrawable;
            // TODO: this doesn't seem to work 
            return d.getStateDrawableIndex(state) != -1;
        } 
        return false; 
    } 
 
    /** 
     * Returns true if the drawable is a StateListDrawable and is in the focused state. 
     *