MaterialCheckBox

public class MaterialCheckBox
extends AppCompatCheckBox

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.Button
         ↳ android.widget.CompoundButton
           ↳ android.widget.CheckBox
             ↳ androidx.appcompat.widget.AppCompatCheckBox
               ↳ com.google.android.material.checkbox.MaterialCheckBox


A class that creates a Material Themed CheckBox.

This class uses attributes from the Material Theme to style a CheckBox. Excepting color changes, it behaves identically to AppCompatCheckBox. Your theme's ?attr/colorControlActivated, ?attr/colorSurface, and ?attr/colorOnSurface must be set.

Summary

Inherited constants

From class android.widget.TextView
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

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

Public methods

boolean isUseMaterialThemeColors()

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

void setUseMaterialThemeColors(boolean useMaterialThemeColors)

Forces the MaterialCheckBox to use colors from a Material Theme.

Protected methods

void onAttachedToWindow()

Inherited methods

From class androidx.appcompat.widget.AppCompatCheckBox
From class android.widget.CheckBox
From class android.widget.CompoundButton
From class android.widget.Button
From class android.widget.TextView
From class android.view.View
From class java.lang.Object
From interface androidx.core.widget.TintableCompoundButton
From interface androidx.core.view.TintableBackgroundView
From interface android.widget.Checkable
From interface android.view.ViewTreeObserver.OnPreDrawListener
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

MaterialCheckBox

MaterialCheckBox (Context context)

Parameters
context Context

MaterialCheckBox

MaterialCheckBox (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

MaterialCheckBox

MaterialCheckBox (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

isUseMaterialThemeColors

boolean isUseMaterialThemeColors ()

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

Returns
boolean

setUseMaterialThemeColors

void setUseMaterialThemeColors (boolean useMaterialThemeColors)

Forces the MaterialCheckBox to use colors from a Material Theme. Overrides any specified ButtonTintList. If set to false, sets the tints to null. Use setSupportButtonTintList(ColorStateList) to change button tints.

Parameters
useMaterialThemeColors boolean

Protected methods

onAttachedToWindow

void onAttachedToWindow ()