Code example for StateListDrawable

Methods: setState

0
 
        if (mImageView != null) {
            Drawable d = mImageView.getDrawable();
            if (d instanceof StateListDrawable) {
                StateListDrawable sld = (StateListDrawable) d;
                sld.setState(getDrawableState());
            } 
        } 
    } 
 
    void invalidatePressedFocusedStates() { 
        mHolographicHelper.invalidatePressedFocusedStates(mImageView);
        invalidate();
    } 
 
    @Override 
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
 
        // One time call to generate the pressed/focused state -- must be called after 
        // measure/layout