# TintableCompoundButton

# TintableCompoundButton

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/widget/TintableCompoundButton.java+class:androidx.core.widget.TintableCompoundButton)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/widget/TintableCompoundButton "View this page in Java")

<br />

```
interface TintableCompoundButton
```

<br />

Known direct subclasses  
[AppCompatCheckBox](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatCheckBox),[AppCompatRadioButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatRadioButton)  

|-----------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AppCompatCheckBox](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatCheckBox)       | A[CheckBox](https://developer.android.com/reference/android/widget/CheckBox.html)which supports compatible features on older versions of the platform, including:       |
| [AppCompatRadioButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatRadioButton) | A[RadioButton](https://developer.android.com/reference/android/widget/RadioButton.html)which supports compatible features on older versions of the platform, including: |

*** ** * ** ***

Interface which allows a[android.widget.CompoundButton](https://developer.android.com/reference/android/widget/CompoundButton.html)to receive tinting calls from`CompoundButtonCompat`when running on API v20 devices or lower.

## Summary

|                                         ### Public functions                                         |
|------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?` | [getSupportButtonTintList](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#getSupportButtonTintList())`()` Returns the tint applied to the button drawable                                                                                                                                                                                                                                                                                                                                                                                        |
| [PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?`  | [getSupportButtonTintMode](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#getSupportButtonTintMode())`()` Returns the blending mode used to apply the tint to the button drawable                                                                                                                                                                                                                                                                                                                                                                |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                        | [setSupportButtonTintList](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#setSupportButtonTintList(android.content.res.ColorStateList))`(tint: `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?)` Applies a tint to the button drawable.                                                                                                                                                                                                                                                     |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                        | [setSupportButtonTintMode](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#setSupportButtonTintMode(android.graphics.PorterDuff.Mode))`(tintMode: `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?)` Specifies the blending mode which should be used to apply the tint specified by[setSupportButtonTintList](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#setSupportButtonTintList(android.content.res.ColorStateList))to the button drawable. |

## Public functions

### getSupportButtonTintList

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun getSupportButtonTintList(): ColorStateList?
```

Returns the tint applied to the button drawable  

|                                                                                      See also                                                                                       |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setSupportButtonTintList](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#setSupportButtonTintList(android.content.res.ColorStateList)) |   |

### getSupportButtonTintMode

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun getSupportButtonTintMode(): PorterDuff.Mode?
```

Returns the blending mode used to apply the tint to the button drawable  

|                                                                                     See also                                                                                      |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [setSupportButtonTintMode](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#setSupportButtonTintMode(android.graphics.PorterDuff.Mode)) |   |

### setSupportButtonTintList

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setSupportButtonTintList(tint: ColorStateList?): Unit
```

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.  

|                                                  Parameters                                                  |
|--------------------------------------------------------------------------------------------------------------|----------------------------------------------|
| `tint: `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?` | the tint to apply, may be`null`to clear tint |

### setSupportButtonTintMode

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun setSupportButtonTintMode(tintMode: PorterDuff.Mode?): Unit
```

Specifies the blending mode which should be used to apply the tint specified by[setSupportButtonTintList](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#setSupportButtonTintList(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).  

|                                                   Parameters                                                    |
|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| `tintMode: `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?` | the blending mode used to apply the tint, may be`null`to clear tint |

|                                                                                           See also                                                                                            |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getSupportButtonTintMode](https://developer.android.com/reference/kotlin/androidx/core/widget/TintableCompoundButton#getSupportButtonTintMode())                                             |   |
| [setTintMode](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/DrawableCompat#setTintMode(android.graphics.drawable.Drawable,android.graphics.PorterDuff.Mode)) |   |