Skip to content

Most visited

Recently visited

navigation

CompoundButtonCompat

public final class CompoundButtonCompat
extends Object

java.lang.Object
   ↳ android.support.v4.widget.CompoundButtonCompat


Helper for accessing CompoundButton methods introduced after API level 4 in a backwards compatible fashion.

Summary

Public methods

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.

Inherited methods

From class java.lang.Object

Public methods

getButtonDrawable

added in version 23.0.0
Drawable getButtonDrawable (CompoundButton button)

Returns the drawable used as the compound button image

Parameters
button CompoundButton

Returns
Drawable

See also:

getButtonTintList

added in version 23.0.0
ColorStateList getButtonTintList (CompoundButton button)

Returns the tint applied to the button drawable

Parameters
button CompoundButton

Returns
ColorStateList

See also:

getButtonTintMode

added in version 23.0.0
PorterDuff.Mode getButtonTintMode (CompoundButton button)

Parameters
button CompoundButton

Returns
PorterDuff.Mode the blending mode used to apply the tint to the button drawable

See also:

setButtonTintList

added in version 23.0.0
void setButtonTintList (CompoundButton button, 
                ColorStateList tint)

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

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

Parameters
button CompoundButton

tint ColorStateList: the tint to apply, may be null to clear tint

See also:

setButtonTintMode

added in version 23.0.0
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. The default mode is SRC_IN.

Parameters
button CompoundButton

tintMode PorterDuff.Mode: the blending mode used to apply the tint, may be null to clear tint

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.