android Programming Glossary: oncreatedrawablestate
What is the difference between the states selected, checked and activated in Android? http://stackoverflow.com/questions/11504860/what-is-the-difference-between-the-states-selected-checked-and-activated-in-and Within that you then need to tell Android whether the state you are implementing is true or false by implementing onCreateDrawableState and calling refreshDrawableState whenever the state changes. item android state_pressed true android drawable @drawable.. refreshDrawableState private static final int mCheckedStateSet android.R.attr.state_checked @Override protected int onCreateDrawableState int extraSpace final int drawableState super.onCreateDrawableState extraSpace 1 if isChecked mergeDrawableStates drawableState.. @Override protected int onCreateDrawableState int extraSpace final int drawableState super.onCreateDrawableState extraSpace 1 if isChecked mergeDrawableStates drawableState mCheckedStateSet return drawableState @Override public void..
How to get a android ListView item selector to use state_checked http://stackoverflow.com/questions/3742979/how-to-get-a-android-listview-item-selector-to-use-state-checked work. How can I get it to do what I want android listview share improve this question You need to override onCreateDrawableState in your CheckableRelativeLayout and set Clickable true for it. My code for LinearLayout public class CheckableLinearLayout.. boolean b checked b public boolean isChecked return checked public void toggle checked checked @Override protected int onCreateDrawableState int extraSpace final int drawableState super.onCreateDrawableState extraSpace 1 if isChecked mergeDrawableStates drawableState.. void toggle checked checked @Override protected int onCreateDrawableState int extraSpace final int drawableState super.onCreateDrawableState extraSpace 1 if isChecked mergeDrawableStates drawableState CheckedStateSet return drawableState @Override public boolean..
Android: how to add a custom button state http://stackoverflow.com/questions/4336060/android-how-to-add-a-custom-button-state setFried boolean isFried mIsFried isFried public void setBaked boolean isBaked mIsBaked isBaked Then override function onCreateDrawableState @Override protected int onCreateDrawableState int extraSpace final int drawableState super.onCreateDrawableState extraSpace.. void setBaked boolean isBaked mIsBaked isBaked Then override function onCreateDrawableState @Override protected int onCreateDrawableState int extraSpace final int drawableState super.onCreateDrawableState extraSpace 2 if mIsFried mergeDrawableStates drawableState.. onCreateDrawableState @Override protected int onCreateDrawableState int extraSpace final int drawableState super.onCreateDrawableState extraSpace 2 if mIsFried mergeDrawableStates drawableState STATE_FRIED if mIsBaked mergeDrawableStates drawableState STATE_BAKED..
|