{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

SwitchColors

public final class SwitchColors


Represents the colors used by a Switch in different states

Summary

Public constructors

SwitchColors(
    @NonNull Color checkedThumbColor,
    @NonNull Color checkedTrackColor,
    @NonNull Color checkedBorderColor,
    @NonNull Color checkedIconColor,
    @NonNull Color uncheckedThumbColor,
    @NonNull Color uncheckedTrackColor,
    @NonNull Color uncheckedBorderColor,
    @NonNull Color uncheckedIconColor,
    @NonNull Color disabledCheckedThumbColor,
    @NonNull Color disabledCheckedTrackColor,
    @NonNull Color disabledCheckedBorderColor,
    @NonNull Color disabledCheckedIconColor,
    @NonNull Color disabledUncheckedThumbColor,
    @NonNull Color disabledUncheckedTrackColor,
    @NonNull Color disabledUncheckedBorderColor,
    @NonNull Color disabledUncheckedIconColor
)

create an instance with arbitrary colors.

Public methods

final @NonNull SwitchColors
copy(
    @NonNull Color checkedThumbColor,
    @NonNull Color checkedTrackColor,
    @NonNull Color checkedBorderColor,
    @NonNull Color checkedIconColor,
    @NonNull Color uncheckedThumbColor,
    @NonNull Color uncheckedTrackColor,
    @NonNull Color uncheckedBorderColor,
    @NonNull Color uncheckedIconColor,
    @NonNull Color disabledCheckedThumbColor,
    @NonNull Color disabledCheckedTrackColor,
    @NonNull Color disabledCheckedBorderColor,
    @NonNull Color disabledCheckedIconColor,
    @NonNull Color disabledUncheckedThumbColor,
    @NonNull Color disabledUncheckedTrackColor,
    @NonNull Color disabledUncheckedBorderColor,
    @NonNull Color disabledUncheckedIconColor
)

Returns a copy of this SwitchColors, optionally overriding some of the values.

boolean
equals(Object other)
final @NonNull Color

the color used for the border when enabled and checked

final @NonNull Color

the color used for the icon when enabled and checked

final @NonNull Color

the color used for the thumb when enabled and checked

final @NonNull Color

the color used for the track when enabled and checked

final @NonNull Color

the color used for the border when disabled and checked

final @NonNull Color

the color used for the icon when disabled and checked

final @NonNull Color

the color used for the thumb when disabled and checked

final @NonNull Color

the color used for the track when disabled and checked

final @NonNull Color

the color used for the border when disabled and unchecked

final @NonNull Color

the color used for the icon when disabled and unchecked

final @NonNull Color

the color used for the thumb when disabled and unchecked

final @NonNull Color

the color used for the track when disabled and unchecked

final @NonNull Color

the color used for the border when enabled and unchecked

final @NonNull Color

the color used for the icon when enabled and unchecked

final @NonNull Color

the color used for the thumb when enabled and unchecked

final @NonNull Color

the color used for the track when enabled and unchecked

int

Public constructors

SwitchColors

public SwitchColors(
    @NonNull Color checkedThumbColor,
    @NonNull Color checkedTrackColor,
    @NonNull Color checkedBorderColor,
    @NonNull Color checkedIconColor,
    @NonNull Color uncheckedThumbColor,
    @NonNull Color uncheckedTrackColor,
    @NonNull Color uncheckedBorderColor,
    @NonNull Color uncheckedIconColor,
    @NonNull Color disabledCheckedThumbColor,
    @NonNull Color disabledCheckedTrackColor,
    @NonNull Color disabledCheckedBorderColor,
    @NonNull Color disabledCheckedIconColor,
    @NonNull Color disabledUncheckedThumbColor,
    @NonNull Color disabledUncheckedTrackColor,
    @NonNull Color disabledUncheckedBorderColor,
    @NonNull Color disabledUncheckedIconColor
)

create an instance with arbitrary colors. See SwitchDefaults.colors for the default implementation that follows Material specifications.

Parameters
@NonNull Color checkedThumbColor

the color used for the thumb when enabled and checked

@NonNull Color checkedTrackColor

the color used for the track when enabled and checked

@NonNull Color checkedBorderColor

the color used for the border when enabled and checked

@NonNull Color checkedIconColor

the color used for the icon when enabled and checked

@NonNull Color uncheckedThumbColor

the color used for the thumb when enabled and unchecked

@NonNull Color uncheckedTrackColor

the color used for the track when enabled and unchecked

@NonNull Color uncheckedBorderColor

the color used for the border when enabled and unchecked

@NonNull Color uncheckedIconColor

the color used for the icon when enabled and unchecked

@NonNull Color disabledCheckedThumbColor

the color used for the thumb when disabled and checked

@NonNull Color disabledCheckedTrackColor

the color used for the track when disabled and checked

@NonNull Color disabledCheckedBorderColor

the color used for the border when disabled and checked

@NonNull Color disabledCheckedIconColor

the color used for the icon when disabled and checked

@NonNull Color disabledUncheckedThumbColor

the color used for the thumb when disabled and unchecked

@NonNull Color disabledUncheckedTrackColor

the color used for the track when disabled and unchecked

@NonNull Color disabledUncheckedBorderColor

the color used for the border when disabled and unchecked

@NonNull Color disabledUncheckedIconColor

the color used for the icon when disabled and unchecked

Public methods

copy

public final @NonNull SwitchColors copy(
    @NonNull Color checkedThumbColor,
    @NonNull Color checkedTrackColor,
    @NonNull Color checkedBorderColor,
    @NonNull Color checkedIconColor,
    @NonNull Color uncheckedThumbColor,
    @NonNull Color uncheckedTrackColor,
    @NonNull Color uncheckedBorderColor,
    @NonNull Color uncheckedIconColor,
    @NonNull Color disabledCheckedThumbColor,
    @NonNull Color disabledCheckedTrackColor,
    @NonNull Color disabledCheckedBorderColor,
    @NonNull Color disabledCheckedIconColor,
    @NonNull Color disabledUncheckedThumbColor,
    @NonNull Color disabledUncheckedTrackColor,
    @NonNull Color disabledUncheckedBorderColor,
    @NonNull Color disabledUncheckedIconColor
)

Returns a copy of this SwitchColors, optionally overriding some of the values. This uses the Color.Unspecified to mean “use the value from the source”

equals

public boolean equals(Object other)

getCheckedBorderColor

public final @NonNull Color getCheckedBorderColor()

the color used for the border when enabled and checked

getCheckedIconColor

public final @NonNull Color getCheckedIconColor()

the color used for the icon when enabled and checked

getCheckedThumbColor

public final @NonNull Color getCheckedThumbColor()

the color used for the thumb when enabled and checked

getCheckedTrackColor

public final @NonNull Color getCheckedTrackColor()

the color used for the track when enabled and checked

getDisabledCheckedBorderColor

public final @NonNull Color getDisabledCheckedBorderColor()

the color used for the border when disabled and checked

getDisabledCheckedIconColor

public final @NonNull Color getDisabledCheckedIconColor()

the color used for the icon when disabled and checked

getDisabledCheckedThumbColor

public final @NonNull Color getDisabledCheckedThumbColor()

the color used for the thumb when disabled and checked

getDisabledCheckedTrackColor

public final @NonNull Color getDisabledCheckedTrackColor()

the color used for the track when disabled and checked

getDisabledUncheckedBorderColor

public final @NonNull Color getDisabledUncheckedBorderColor()

the color used for the border when disabled and unchecked

getDisabledUncheckedIconColor

public final @NonNull Color getDisabledUncheckedIconColor()

the color used for the icon when disabled and unchecked

getDisabledUncheckedThumbColor

public final @NonNull Color getDisabledUncheckedThumbColor()

the color used for the thumb when disabled and unchecked

getDisabledUncheckedTrackColor

public final @NonNull Color getDisabledUncheckedTrackColor()

the color used for the track when disabled and unchecked

getUncheckedBorderColor

public final @NonNull Color getUncheckedBorderColor()

the color used for the border when enabled and unchecked

getUncheckedIconColor

public final @NonNull Color getUncheckedIconColor()

the color used for the icon when enabled and unchecked

getUncheckedThumbColor

public final @NonNull Color getUncheckedThumbColor()

the color used for the thumb when enabled and unchecked

getUncheckedTrackColor

public final @NonNull Color getUncheckedTrackColor()

the color used for the track when enabled and unchecked

hashCode

public int hashCode()