CompoundButtonCompat

Added in 1.1.0

class CompoundButtonCompat


Helper for accessing CompoundButton.

Summary

Public functions

java-static Drawable?

Returns the drawable used as the compound button image

java-static ColorStateList?

Returns the tint applied to the button drawable

java-static PorterDuff.Mode?

name android:buttonTintMode

java-static Unit

Applies a tint to the button drawable.

java-static Unit

Specifies the blending mode used to apply the tint specified by setButtonTintList} to the button drawable.

Public functions

getButtonDrawable

Added in 1.1.0
java-static fun getButtonDrawable(button: CompoundButton): Drawable?

Returns the drawable used as the compound button image

getButtonTintList

Added in 1.1.0
java-static fun getButtonTintList(button: CompoundButton): ColorStateList?

Returns the tint applied to the button drawable

getButtonTintMode

Added in 1.1.0
java-static fun getButtonTintMode(button: CompoundButton): PorterDuff.Mode?

name android:buttonTintMode

Returns
PorterDuff.Mode?

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

setButtonTintList

Added in 1.1.0
java-static fun setButtonTintList(button: CompoundButton, tint: ColorStateList?): Unit

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

Subsequent calls to setButtonDrawable should automatically mutate the drawable and apply the specified tint and tint mode using setTintList.

Parameters
button: CompoundButton

button for which to apply the tint.

tint: ColorStateList?

the tint to apply, may be null to clear tint

setButtonTintMode

Added in 1.1.0
java-static fun setButtonTintMode(button: CompoundButton, tintMode: PorterDuff.Mode?): Unit

Specifies the blending mode used to apply the tint specified by setButtonTintList} to the button drawable. The default mode is SRC_IN.

Parameters
button: CompoundButton

button for which to apply the tint mode.

tintMode: PorterDuff.Mode?

the blending mode used to apply the tint, may be null to clear tint

API reference packages and classes for Android app developers.

Updated Feb 13, 2025

API reference packages and classes for Android app developers.

Updated Feb 13, 2025

API reference packages and classes for Android app developers.

Updated Feb 10, 2025