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
.
Related Contents:
- How to add a custom button state
- Dynamically add a Edit text
- How to declare global variables in Android?
- How to handle button clicks using the XML onClick within Fragments
- Android: ListView elements with multiple clickable buttons
- How to prevent custom views from losing state across screen orientation changes
- How to save RecyclerView’s scroll position using RecyclerView.State?
- Android button background is taking the primary color
- Android: combining text & image on a Button or ImageButton
- How to Set Opacity (Alpha) for View in Android
- Android – border for button
- Android ImageButton with a selected state?
- Android: Using findViewById() with a string / in a loop
- Coloring Buttons in Android with Material Design and AppCompat
- How to create standard Borderless buttons (like in the design guideline mentioned)?
- How do I apply a style to all buttons of an Android application
- Call method when home button pressed
- How to set a particular font for a button text in android?
- Android setOnClickListener method – How does it work?
- How to add to my android application a button than do like to a facebook page?
- Best practice for defining button events in android
- Get the background color of a button in android
- How to center icon and text in a android button with width set to “fill parent”
- How do I programmatically add buttons into layout one by one in several lines?
- Add button to a layout programmatically
- How to disable / enable dialog negative positive buttons?
- android image button
- Event OnClick for a button in a custom notification
- Android save Checkbox State in ListView with Cursor Adapter
- How to open the options menu programmatically?
- android set button background programmatically
- Handling buttons inside android notifications
- How to handle Back button with in the dialog?
- One OnClickHandler for multiple Buttons
- How to create custom shape button with selector in android?
- How to bring view in front of everything?
- Android: textColor of disabled button in selector not showing?
- How to prevent the activity from loading twice on pressing the button
- Android button background color
- how to change background image of button when clicked/focused?
- How to open Navigation Drawer with no actionbar, open with just a button
- Detecting outgoing call and call hangup event in android
- Triggering event when Button is pressed down in Android
- Dynamically creating Buttons and setting onClickListener
- Add an array of buttons to a GridView in an Android application
- Single click and double click of a button in android
- Cannot lower case button text in android studio
- Can I click a button programmatically for a predefined intent?
- How can I keep a button as pressed after clicking on it? [duplicate]
- OnItemClickListener doesn’t work with ListView item containing button