public final class CompoundButtonCompat extends Object
CompoundButton
methods introduced after
API level 4 in a backwards compatible fashion.Modifier and Type | Method and Description |
---|---|
static Drawable |
getButtonDrawable(CompoundButton button)
Returns the drawable used as the compound button image
|
static ColorStateList |
getButtonTintList(CompoundButton button)
Returns the tint applied to the button drawable
|
static PorterDuff.Mode |
getButtonTintMode(CompoundButton button) |
static void |
setButtonTintList(CompoundButton button,
ColorStateList tint)
Applies a tint to the button drawable.
|
static void |
setButtonTintMode(CompoundButton button,
PorterDuff.Mode tintMode)
Specifies the blending mode used to apply the tint specified by
setButtonTintList(CompoundButton, ColorStateList) } to the button drawable. |
public static void setButtonTintList(@NonNull CompoundButton button, @Nullable ColorStateList tint)
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)
.
tint
- the tint to apply, may be null
to clear tintsetButtonTintList(CompoundButton, ColorStateList)
@Nullable public static ColorStateList getButtonTintList(@NonNull CompoundButton button)
public static void setButtonTintMode(@NonNull CompoundButton button, @Nullable PorterDuff.Mode tintMode)
setButtonTintList(CompoundButton, ColorStateList)
} to the button drawable. The
default mode is PorterDuff.Mode#SRC_IN
.tintMode
- the blending mode used to apply the tint, may be
null
to clear tintgetButtonTintMode(CompoundButton)
,
DrawableCompat.setTintMode(Drawable, PorterDuff.Mode)
@Nullable public static PorterDuff.Mode getButtonTintMode(@NonNull CompoundButton button)
#setButtonTintMode(PorterDuff.Mode)
@Nullable public static Drawable getButtonDrawable(@NonNull CompoundButton button)