# CompoundButtonCompat

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#)  

# CompoundButtonCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
CompoundButtonCompat
`  
`

extends Object


``


`

|---|------------------------------------------------|
| java.lang.Object                                  ||
| ↳ | android.support.v4.widget.CompoundButtonCompat |

<br />

*** ** * ** ***

Helper for accessing[CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton.html).

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                       ||
|-------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)       | ` `[getButtonDrawable](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#getButtonDrawable(android.widget.CompoundButton))`(`[CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton.html)` button) ` Returns the drawable used as the compound button image                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` static `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html) | ` `[getButtonTintList](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#getButtonTintList(android.widget.CompoundButton))`(`[CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton.html)` button) ` Returns the tint applied to the button drawable                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` static `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)  | ` `[getButtonTintMode](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#getButtonTintMode(android.widget.CompoundButton))`(`[CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton.html)` button) `                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` static void`                                                                                              | ` `[setButtonTintList](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#setButtonTintList(android.widget.CompoundButton, android.content.res.ColorStateList))`(`[CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton.html)` button, `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)` tint) ` Applies a tint to the button drawable.                                                                                                                                                                                                                                                                                    |
| ` static void`                                                                                              | ` `[setButtonTintMode](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#setButtonTintMode(android.widget.CompoundButton, android.graphics.PorterDuff.Mode))`(`[CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton.html)` button, `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)` tintMode) ` Specifies the blending mode used to apply the tint specified by[setButtonTintList(CompoundButton, ColorStateList)](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#setButtonTintList(android.widget.CompoundButton, android.content.res.ColorStateList))} to the button drawable. |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### getButtonDrawable

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Drawable getButtonDrawable (CompoundButton button)
```

Returns the drawable used as the compound button image

<br />

|            Parameters             ||
|----------|-------------------------|
| `button` | `CompoundButton` <br /> |

|                                               Returns                                               ||
|---------------------------------------------------------------------------------------------|--------|
| [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html) | <br /> |

**See also:**

- [setButtonDrawable(Drawable)](https://developer.android.com/https://developer.android.com/reference/android/widget/CompoundButton#setButtonDrawable(android.graphics.drawable.Drawable))  

### getButtonTintList

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
ColorStateList getButtonTintList (CompoundButton button)
```

Returns the tint applied to the button drawable

<br />

|            Parameters             ||
|----------|-------------------------|
| `button` | `CompoundButton` <br /> |

|                                                  Returns                                                  ||
|---------------------------------------------------------------------------------------------------|--------|
| [ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html) | <br /> |

**See also:**

- [setButtonTintList(CompoundButton, ColorStateList)](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#setButtonTintList(android.widget.CompoundButton, android.content.res.ColorStateList))  

### getButtonTintMode

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
PorterDuff.Mode getButtonTintMode (CompoundButton button)
```

<br />

<br />

|            Parameters             ||
|----------|-------------------------|
| `button` | `CompoundButton` <br /> |

|                                                                                 Returns                                                                                  ||
|--------------------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html) | the blending mode used to apply the tint to the button drawable <br /> |

**See also:**

- [setButtonTintMode(CompoundButton, PorterDuff.Mode)](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#setButtonTintMode(android.widget.CompoundButton, android.graphics.PorterDuff.Mode))  

### setButtonTintList

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setButtonTintList (CompoundButton button, 
                ColorStateList tint)
```

Applies a tint to the button drawable. Does not modify the current tint mode, which is[SRC_IN](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html#SRC_IN)by default.

Subsequent calls to[setButtonDrawable(Drawable)](https://developer.android.com/reference/android/widget/CompoundButton.html#setButtonDrawable(android.graphics.drawable.Drawable))should automatically mutate the drawable and apply the specified tint and tint mode using[setTintList(Drawable, ColorStateList)](https://developer.android.com/reference/android/support/v4/graphics/drawable/DrawableCompat#setTintList(android.graphics.drawable.Drawable, android.content.res.ColorStateList)).

<br />

|                                   Parameters                                    ||
|----------|-----------------------------------------------------------------------|
| `button` | `CompoundButton` <br />                                               |
| `tint`   | `ColorStateList`: the tint to apply, may be`null`to clear tint <br /> |

**See also:**

- [setButtonTintList(CompoundButton, ColorStateList)](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#setButtonTintList(android.widget.CompoundButton, android.content.res.ColorStateList))  

### setButtonTintMode

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void setButtonTintMode (CompoundButton button, 
                PorterDuff.Mode tintMode)
```

Specifies the blending mode used to apply the tint specified by[setButtonTintList(CompoundButton, ColorStateList)](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#setButtonTintList(android.widget.CompoundButton, android.content.res.ColorStateList))} to the button drawable. The default mode is[SRC_IN](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html#SRC_IN).

<br />

|                                                Parameters                                                 ||
|------------|-----------------------------------------------------------------------------------------------|
| `button`   | `CompoundButton` <br />                                                                       |
| `tintMode` | `PorterDuff.Mode`: the blending mode used to apply the tint, may be`null`to clear tint <br /> |

**See also:**

- [getButtonTintMode(CompoundButton)](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat#getButtonTintMode(android.widget.CompoundButton))
- [setTintMode(Drawable, PorterDuff.Mode)](https://developer.android.com/reference/android/support/v4/graphics/drawable/DrawableCompat#setTintMode(android.graphics.drawable.Drawable, android.graphics.PorterDuff.Mode))  
-

  ## Interfaces

  - [DrawerLayout.DrawerListener](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.DrawerListener)
  - [NestedScrollView.OnScrollChangeListener](https://developer.android.com/reference/android/support/v4/widget/NestedScrollView.OnScrollChangeListener)
  - [SimpleCursorAdapter.CursorToStringConverter](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter.CursorToStringConverter)
  - [SimpleCursorAdapter.ViewBinder](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter.ViewBinder)
  - [SlidingPaneLayout.PanelSlideListener](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.PanelSlideListener)
  - [SwipeRefreshLayout.OnChildScrollUpCallback](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.OnChildScrollUpCallback)
  - [SwipeRefreshLayout.OnRefreshListener](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.OnRefreshListener)
  - [TintableCompoundButton](https://developer.android.com/reference/android/support/v4/widget/TintableCompoundButton)
-

  ## Classes

  - [AutoScrollHelper](https://developer.android.com/reference/android/support/v4/widget/AutoScrollHelper)
  - [CircularProgressDrawable](https://developer.android.com/reference/android/support/v4/widget/CircularProgressDrawable)
  - [CompoundButtonCompat](https://developer.android.com/reference/android/support/v4/widget/CompoundButtonCompat)
  - [ContentLoadingProgressBar](https://developer.android.com/reference/android/support/v4/widget/ContentLoadingProgressBar)
  - [CursorAdapter](https://developer.android.com/reference/android/support/v4/widget/CursorAdapter)
  - [DrawerLayout](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout)
  - [DrawerLayout.LayoutParams](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.LayoutParams)
  - [DrawerLayout.SavedState](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.SavedState)
  - [DrawerLayout.SimpleDrawerListener](https://developer.android.com/reference/android/support/v4/widget/DrawerLayout.SimpleDrawerListener)
  - [EdgeEffectCompat](https://developer.android.com/reference/android/support/v4/widget/EdgeEffectCompat)
  - [ExploreByTouchHelper](https://developer.android.com/reference/android/support/v4/widget/ExploreByTouchHelper)
  - [ImageViewCompat](https://developer.android.com/reference/android/support/v4/widget/ImageViewCompat)
  - [ListPopupWindowCompat](https://developer.android.com/reference/android/support/v4/widget/ListPopupWindowCompat)
  - [ListViewAutoScrollHelper](https://developer.android.com/reference/android/support/v4/widget/ListViewAutoScrollHelper)
  - [ListViewCompat](https://developer.android.com/reference/android/support/v4/widget/ListViewCompat)
  - [NestedScrollView](https://developer.android.com/reference/android/support/v4/widget/NestedScrollView)
  - [PopupMenuCompat](https://developer.android.com/reference/android/support/v4/widget/PopupMenuCompat)
  - [PopupWindowCompat](https://developer.android.com/reference/android/support/v4/widget/PopupWindowCompat)
  - [ResourceCursorAdapter](https://developer.android.com/reference/android/support/v4/widget/ResourceCursorAdapter)
  - [ScrollerCompat](https://developer.android.com/reference/android/support/v4/widget/ScrollerCompat)
  - [SimpleCursorAdapter](https://developer.android.com/reference/android/support/v4/widget/SimpleCursorAdapter)
  - [SlidingPaneLayout](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout)
  - [SlidingPaneLayout.LayoutParams](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.LayoutParams)
  - [SlidingPaneLayout.SimplePanelSlideListener](https://developer.android.com/reference/android/support/v4/widget/SlidingPaneLayout.SimplePanelSlideListener)
  - [Space](https://developer.android.com/reference/android/support/v4/widget/Space)
  - [SwipeRefreshLayout](https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout)
  - [TextViewCompat](https://developer.android.com/reference/android/support/v4/widget/TextViewCompat)
  - [ViewDragHelper](https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper)
  - [ViewDragHelper.Callback](https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.Callback)