Code example for StateListDrawable

Methods: addState

0
    } 
 
    /** Sets the images representing the "clicked" and "unclicked" state */ 
    private void setActiveAndInactive(BitmapDrawable active, BitmapDrawable inactive) {
 
        StateListDrawable states = new StateListDrawable();
 
        states.addState( new int[] { CloseButtonState.Down.getAndroidState() }, active   );
 
        states.addState( new int[] { CloseButtonState.Up.getAndroidState()   }, inactive );
 
        this.setImageDrawable(states);
    } 
}