SwitchMaterial

public class SwitchMaterial


A class that creates a Material Themed Switch.

This class uses attributes from the Material Theme to style a Switch. Excepting color changes, it behaves identically to SwitchCompat. Your theme's ?attr/colorControlActivated, ?attr/colorSurface, and ?attr/colorOnSurface must be set. Because does not extend android.widget.Switch, you must explicitly declare in your layout XML.

Summary

Public constructors

SwitchMaterial(Context context)
SwitchMaterial(Context context, AttributeSet attrs)
SwitchMaterial(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

boolean

Returns true if this SwitchMaterial defaults to colors from a Material Theme.

void
setUseMaterialThemeColors(boolean useMaterialThemeColors)

Forces the SwitchMaterial to use colors from a Material Theme.

Protected methods

void

Public constructors

SwitchMaterial

public SwitchMaterial(Context context)

SwitchMaterial

public SwitchMaterial(Context context, AttributeSet attrs)

SwitchMaterial

public SwitchMaterial(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

isUseMaterialThemeColors

public boolean isUseMaterialThemeColors()

Returns true if this SwitchMaterial defaults to colors from a Material Theme.

setUseMaterialThemeColors

public void setUseMaterialThemeColors(boolean useMaterialThemeColors)

Forces the SwitchMaterial to use colors from a Material Theme. Overrides any specified tint list for the track and thumb. If set to false, sets the tints to null. Use setTrackTintList and setThumbTintList to change tints.

Protected methods

onAttachedToWindow

protected void onAttachedToWindow()