Return to Snippet

Revision: 65505
at December 9, 2013 11:35 by cruddell001


Initial Code
//set up (normal) and down (pressed) states for a button
Drawable imageUp = null;
Drawable imageDown = null;
//set Drawable images here
StateListDrawable stateListDrawable = new StateListDrawable();
stateListDrawable.addState(new int[] {android.R.attr.state_pressed},imageDown);
stateListDrawable.addState(StateSet.WILD_CARD, imageUp);
theButton.setBackgroundDrawable(stateListDrawable);

Initial URL

                                

Initial Description

                                

Initial Title
Up and Down states for buttons

Initial Tags

                                

Initial Language
Java