Register now for Android Dev Summit 2019!

MaterialRadioButton

public class MaterialRadioButton
extends AppCompatRadioButton

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.Button
         ↳ android.widget.CompoundButton
           ↳ android.widget.RadioButton
             ↳ androidx.appcompat.widget.AppCompatRadioButton
               ↳ com.google.android.material.radiobutton.MaterialRadioButton


A class that creates a Material Themed RadioButton.

This class uses attributes from the Material Theme to style a RadioButton. Excepting color changes, it behaves identically to AppCompatRadioButton. 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

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

Public methods

boolean isUseMaterialThemeColors()

Returns true if the colors of this MaterialRadioButton are from a Material Theme.

void setUseMaterialThemeColors(boolean useMaterialThemeColors)

Forces the MaterialRadioButton to use colors from a Material Theme.

Inherited methods

From class androidx.appcompat.widget.AppCompatRadioButton
From class android.widget.RadioButton
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

MaterialRadioButton

MaterialRadioButton (Context context)

Parameters
context Context

MaterialRadioButton

MaterialRadioButton (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

MaterialRadioButton

MaterialRadioButton (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

isUseMaterialThemeColors

boolean isUseMaterialThemeColors ()

Returns true if the colors of this MaterialRadioButton are from a Material Theme.

Returns
boolean True if the colors of this MaterialRadioButton are from a Material Theme.

setUseMaterialThemeColors

void setUseMaterialThemeColors (boolean useMaterialThemeColors)

Forces the MaterialRadioButton 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