# TintableBackgroundView

# TintableBackgroundView

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/view/TintableBackgroundView.java+class:androidx.core.view.TintableBackgroundView)  
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/view/TintableBackgroundView "View this page in Java")

<br />

```
interface TintableBackgroundView
```

<br />

Known direct subclasses  
[AppCompatAutoCompleteTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatAutoCompleteTextView),[AppCompatButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatButton),[AppCompatCheckBox](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatCheckBox),[AppCompatCheckedTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatCheckedTextView),[AppCompatEditText](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatEditText),[AppCompatImageButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatImageButton),[AppCompatImageView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatImageView),[AppCompatMultiAutoCompleteTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextView),[AppCompatRadioButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatRadioButton),[AppCompatSpinner](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatSpinner),[AppCompatTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatTextView),[AppCompatToggleButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatToggleButton)  

|---------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AppCompatAutoCompleteTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatAutoCompleteTextView)           | A[AutoCompleteTextView](https://developer.android.com/reference/android/widget/AutoCompleteTextView.html)which supports compatible features on older versions of the platform, including:          |
| [AppCompatButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatButton)                                       | A[Button](https://developer.android.com/reference/android/widget/Button.html)which supports compatible features on older versions of the platform, including:                                      |
| [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:                                  |
| [AppCompatCheckedTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatCheckedTextView)                     | A[CheckedTextView](https://developer.android.com/reference/android/widget/CheckedTextView.html)which supports compatible features on older versions of the platform, including:                    |
| [AppCompatEditText](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatEditText)                                   | A[EditText](https://developer.android.com/reference/android/widget/EditText.html)which supports compatible features on older versions of the platform, including:                                  |
| [AppCompatImageButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatImageButton)                             | A[ImageButton](https://developer.android.com/reference/android/widget/ImageButton.html)which supports compatible features on older versions of the platform, including:                            |
| [AppCompatImageView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatImageView)                                 | A[ImageView](https://developer.android.com/reference/android/widget/ImageView.html)which supports compatible features on older versions of the platform, including:                                |
| [AppCompatMultiAutoCompleteTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatMultiAutoCompleteTextView) | A[MultiAutoCompleteTextView](https://developer.android.com/reference/android/widget/MultiAutoCompleteTextView.html)which supports compatible features on older version 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:                            |
| [AppCompatSpinner](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatSpinner)                                     | A[Spinner](https://developer.android.com/reference/android/widget/Spinner.html)which supports compatible features on older versions of the platform, including:                                    |
| [AppCompatTextView](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatTextView)                                   | A[TextView](https://developer.android.com/reference/android/widget/TextView.html)which supports compatible features on older versions of the platform, including:                                  |
| [AppCompatToggleButton](https://developer.android.com/reference/kotlin/androidx/appcompat/widget/AppCompatToggleButton)                           | A[ToggleButton](https://developer.android.com/reference/android/widget/ToggleButton.html)which supports compatible features on older versions of the platform, including:                          |

Known indirect subclasses  
[EmojiAppCompatButton](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiAppCompatButton),[EmojiAppCompatEditText](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiAppCompatEditText),[EmojiAppCompatTextView](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiAppCompatTextView),[GuidedActionAppCompatEditText](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionAppCompatEditText),[ImageFilterButton](https://developer.android.com/reference/kotlin/androidx/constraintlayout/utils/widget/ImageFilterButton),[ImageFilterView](https://developer.android.com/reference/kotlin/androidx/constraintlayout/utils/widget/ImageFilterView),[MotionButton](https://developer.android.com/reference/kotlin/androidx/constraintlayout/utils/widget/MotionButton)  

|----------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [EmojiAppCompatButton](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiAppCompatButton)                      | AppCompatButton widget enhanced with emoji capability by using[EmojiTextViewHelper](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiTextViewHelper).   |
| [EmojiAppCompatEditText](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiAppCompatEditText)                  | AppCompatEditText widget enhanced with emoji capability by using[EmojiEditTextHelper](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiEditTextHelper). |
| [EmojiAppCompatTextView](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiAppCompatTextView)                  | AppCompatTextView widget enhanced with emoji capability by using[EmojiTextViewHelper](https://developer.android.com/reference/kotlin/androidx/emoji/widget/EmojiTextViewHelper). |
| [GuidedActionAppCompatEditText](https://developer.android.com/reference/kotlin/androidx/leanback/widget/GuidedActionAppCompatEditText) | A custom EditText that satisfies the IME key monitoring requirements of GuidedStepFragment.                                                                                      |
| [ImageFilterButton](https://developer.android.com/reference/kotlin/androidx/constraintlayout/utils/widget/ImageFilterButton)           | An AppCompatImageButton that can display, combine and filter images.                                                                                                             |
| [ImageFilterView](https://developer.android.com/reference/kotlin/androidx/constraintlayout/utils/widget/ImageFilterView)               | An ImageView that can display, combine and filter images.                                                                                                                        |
| [MotionButton](https://developer.android.com/reference/kotlin/androidx/constraintlayout/utils/widget/MotionButton)                     | A MotionButton is an AppCompatButton that can round its edges.                                                                                                                   |

*** ** * ** ***

Interface which allows a[android.view.View](https://developer.android.com/reference/android/view/View.html)to receive background tinting calls from[ViewCompat](https://developer.android.com/reference/kotlin/androidx/core/view/ViewCompat)when running on API v20 devices or lower.

## Summary

|                                         ### Public functions                                         |
|------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?` | [getSupportBackgroundTintList](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#getSupportBackgroundTintList())`()` Return the tint applied to the background drawable, if specified.                                                                                                                                                                                                                                                                                                                                                                  |
| [PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?`  | [getSupportBackgroundTintMode](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#getSupportBackgroundTintMode())`()` Return the blending mode used to apply the tint to the background drawable, if specified.                                                                                                                                                                                                                                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                        | [setSupportBackgroundTintList](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#setSupportBackgroundTintList(android.content.res.ColorStateList))`(tint: `[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?)` Applies a tint to the background drawable.                                                                                                                                                                                                                                             |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                        | [setSupportBackgroundTintMode](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#setSupportBackgroundTintMode(android.graphics.PorterDuff.Mode))`(tintMode: `[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?)` Specifies the blending mode used to apply the tint specified by[setSupportBackgroundTintList](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#setSupportBackgroundTintList(android.content.res.ColorStateList))} to the background drawable. |

## Public functions

### getSupportBackgroundTintList

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

```
fun getSupportBackgroundTintList(): ColorStateList?
```

Return the tint applied to the background drawable, if specified.  

|                                               Returns                                                |
|------------------------------------------------------------------------------------------------------|---------------------------------------------|
| [ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList.html)`?` | the tint applied to the background drawable |

### getSupportBackgroundTintMode

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

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

Return the blending mode used to apply the tint to the background drawable, if specified.  

|                                               Returns                                               |
|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| [PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html)`?` | the blending mode used to apply the tint to the background drawable |

### setSupportBackgroundTintList

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

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

Applies a tint to the background 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`View.setBackground(Drawable)`will 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 |

|                                                                        See also                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getSupportBackgroundTintList](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#getSupportBackgroundTintList()) |   |

### setSupportBackgroundTintMode

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

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

Specifies the blending mode used to apply the tint specified by[setSupportBackgroundTintList](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#setSupportBackgroundTintList(android.content.res.ColorStateList))} to the background 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                                                                         |
|---------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [getSupportBackgroundTintMode](https://developer.android.com/reference/kotlin/androidx/core/view/TintableBackgroundView#getSupportBackgroundTintMode()) |   |