CompoundButtonCompat

class CompoundButtonCompat
kotlin.Any
   ↳ androidx.core.widget.CompoundButtonCompat

Helper for accessing android.widget.CompoundButton.

Summary

Public methods
static Unit

Applies a tint to the button drawable.

static ColorStateList?

Returns the tint applied to the button drawable

static Unit
setButtonTintMode(button: CompoundButton, tintMode: Mode?)

Specifies the blending mode used to apply the tint specified by #setButtonTintList(CompoundButton, ColorStateList)} to the button drawable.

static Mode?

static Drawable?

Returns the drawable used as the compound button image

Public methods

setButtonTintList

static fun setButtonTintList(button: CompoundButton, tint: ColorStateList?): Unit

Applies a tint to the button drawable. Does not modify the current tint mode, which is PorterDuff.Mode#SRC_IN by default.

Subsequent calls to CompoundButton#setButtonDrawable(Drawable) should automatically mutate the drawable and apply the specified tint and tint mode using DrawableCompat#setTintList(Drawable, ColorStateList).

Parameters
tint CompoundButton: the tint to apply, may be null to clear tint

getButtonTintList

static fun getButtonTintList(button: CompoundButton): ColorStateList?

Returns the tint applied to the button drawable

setButtonTintMode

static fun setButtonTintMode(button: CompoundButton, tintMode: Mode?): Unit

Specifies the blending mode used to apply the tint specified by #setButtonTintList(CompoundButton, ColorStateList)} to the button drawable. The default mode is PorterDuff.Mode#SRC_IN.

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

getButtonTintMode

static fun getButtonTintMode(button: CompoundButton): Mode?
Return
Mode?: the blending mode used to apply the tint to the button drawable

getButtonDrawable

static fun getButtonDrawable(button: CompoundButton): Drawable?

Returns the drawable used as the compound button image