Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

TintableBackgroundView

interface TintableBackgroundView
androidx.core.view.TintableBackgroundView

Interface which allows a android.view.View to receive background tinting calls from ViewCompat when running on API v20 devices or lower.

Summary

Public methods

abstract ColorStateList?

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

abstract Mode?

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

abstract Unit

Applies a tint to the background drawable.

abstract Unit
setSupportBackgroundTintMode(@Nullable tintMode: Mode?)

Specifies the blending mode used to apply the tint specified by setSupportBackgroundTintList(ColorStateList)} to the background drawable.

Public methods

getSupportBackgroundTintList

@Nullable abstract fun getSupportBackgroundTintList(): ColorStateList?

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

Return
ColorStateList?: the tint applied to the background drawable

getSupportBackgroundTintMode

@Nullable abstract fun getSupportBackgroundTintMode(): Mode?

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

Return
Mode?: the blending mode used to apply the tint to the background drawable

setSupportBackgroundTintList

abstract fun setSupportBackgroundTintList(@Nullable tint: ColorStateList?): Unit

Applies a tint to the background drawable. Does not modify the current tint mode, which is PorterDuff.Mode#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?: the tint to apply, may be null to clear tint

setSupportBackgroundTintMode

abstract fun setSupportBackgroundTintMode(@Nullable tintMode: Mode?): Unit

Specifies the blending mode used to apply the tint specified by setSupportBackgroundTintList(ColorStateList)} to the background drawable. The default mode is PorterDuff.Mode#SRC_IN.

Parameters
tintMode Mode?: the blending mode used to apply the tint, may be null to clear tint