You need to use the negative value of the needed state.
E.g.:
states.addState(new int[] {-android.R.attr.state_enabled},R.drawable.btn_disabled);
Notice the “-” sign before android.R.attr.state_enabled
.
More Related Contents:
- How to add a custom button state
- How to handle button clicks using the XML onClick within Fragments
- Android: ListView elements with multiple clickable buttons
- Android button background is taking the primary color
- Coloring Buttons in Android with Material Design and AppCompat
- How do I programmatically add buttons into layout one by one in several lines?
- Call method when home button pressed
- How to center icon and text in a android button with width set to “fill parent”
- Handling buttons inside android notifications
- How to disable / enable dialog negative positive buttons?
- Event OnClick for a button in a custom notification
- How to open the options menu programmatically?
- android fragment onRestoreInstanceState
- Android: textColor of disabled button in selector not showing?
- Android : change button text and background color
- android image button
- Put buttons at bottom of screen with LinearLayout?
- How to add button in ActionBar(Android)?
- Android button background color
- Triggering event when Button is pressed down in Android
- Cannot lower case button text in android studio
- Change button color in AlertDialog
- How do I kill an Activity when the Back button is pressed?
- How can I keep a button as pressed after clicking on it? [duplicate]
- OnItemClickListener doesn’t work with ListView item containing button
- How to avoid multiple button click at same time in android?
- Multi-State Toggle Button
- Exception: This is not supported, use MenuItemCompat.getActionProvider()
- Playing short .wav files – Android
- Android: Creating shaped button