CompoundButtonCompat
class CompoundButtonCompat
kotlin.Any | |
↳ | androidx.core.widget.CompoundButtonCompat |
Helper for accessing android.widget.CompoundButton
.
Summary
Public methods | |
---|---|
static Drawable? |
getButtonDrawable(@NonNull button: CompoundButton) Returns the drawable used as the compound button image |
static ColorStateList? |
getButtonTintList(@NonNull button: CompoundButton) Returns the tint applied to the button drawable |
static Mode? |
getButtonTintMode(@NonNull button: CompoundButton) |
static Unit |
setButtonTintList(@NonNull button: CompoundButton, @Nullable tint: ColorStateList?) Applies a tint to the button drawable. |
static Unit |
setButtonTintMode(@NonNull button: CompoundButton, @Nullable tintMode: Mode?) Specifies the blending mode used to apply the tint specified by |
Public methods
getButtonDrawable
@Nullable static fun getButtonDrawable(@NonNull button: CompoundButton): Drawable?
Returns the drawable used as the compound button image
getButtonTintList
@Nullable static fun getButtonTintList(@NonNull button: CompoundButton): ColorStateList?
Returns the tint applied to the button drawable
getButtonTintMode
@Nullable static fun getButtonTintMode(@NonNull button: CompoundButton): Mode?
Return | |
---|---|
Mode? |
the blending mode used to apply the tint to the button drawable |
setButtonTintList
static fun setButtonTintList(
@NonNull button: CompoundButton,
@Nullable 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 |
ColorStateList?: the tint to apply, may be null to clear tint |
setButtonTintMode
static fun setButtonTintMode(
@NonNull button: CompoundButton,
@Nullable 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 |
Mode?: the blending mode used to apply the tint, may be null to clear tint |