¡@

Home 

2014/10/16 ¤W¤È 08:25:04

android Programming Glossary: states.addstate

replace selector images programmatically

http://stackoverflow.com/questions/4697528/replace-selector-images-programmatically

code StateListDrawable states new StateListDrawable states.addState new int android.R.attr.state_pressed getResources .getDrawable.. getResources .getDrawable R.drawable.pressed states.addState new int android.R.attr.state_focused getResources .getDrawable.. getResources .getDrawable R.drawable.focused states.addState new int getResources .getDrawable R.drawable.normal imageView.setImageDrawable..

Android : How to update the selector(StateListDrawable) programmatically

http://stackoverflow.com/questions/5092649/android-how-to-update-the-selectorstatelistdrawable-programmatically

int index StateListDrawable states new StateListDrawable states.addState new int android.R.attr.stateNotNeeded R.drawable.btn_off states.addState.. new int android.R.attr.stateNotNeeded R.drawable.btn_off states.addState new int android.R.attr.state_pressed android.R.attr.state_enabled.. android.R.attr.state_enabled R.drawable.btn_off states.addState new int android.R.attr.state_focused android.R.attr.state_enabled..

replace selector images programmatically

http://stackoverflow.com/questions/4697528/replace-selector-images-programmatically

has already been defined. You can however define a NEW one through code StateListDrawable states new StateListDrawable states.addState new int android.R.attr.state_pressed getResources .getDrawable R.drawable.pressed states.addState new int android.R.attr.state_focused.. StateListDrawable states.addState new int android.R.attr.state_pressed getResources .getDrawable R.drawable.pressed states.addState new int android.R.attr.state_focused getResources .getDrawable R.drawable.focused states.addState new int getResources .getDrawable.. R.drawable.pressed states.addState new int android.R.attr.state_focused getResources .getDrawable R.drawable.focused states.addState new int getResources .getDrawable R.drawable.normal imageView.setImageDrawable states And you could just keep two of them..

Android : How to update the selector(StateListDrawable) programmatically

http://stackoverflow.com/questions/5092649/android-how-to-update-the-selectorstatelistdrawable-programmatically

given below private StateListDrawable setImageButtonState int index StateListDrawable states new StateListDrawable states.addState new int android.R.attr.stateNotNeeded R.drawable.btn_off states.addState new int android.R.attr.state_pressed android.R.attr.state_enabled.. states new StateListDrawable states.addState new int android.R.attr.stateNotNeeded R.drawable.btn_off states.addState new int android.R.attr.state_pressed android.R.attr.state_enabled R.drawable.btn_off states.addState new int android.R.attr.state_focused.. states.addState new int android.R.attr.state_pressed android.R.attr.state_enabled R.drawable.btn_off states.addState new int android.R.attr.state_focused android.R.attr.state_enabled R.drawable.btn_on states.addState new int android.R.attr.state_enabled..