Android 12 Developer Preview is here! Try it out, and give us your feedback!

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

Inherited fields

Public constructors

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

Public methods

boolean isUseMaterialThemeColors()

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

void setUseMaterialThemeColors(boolean useMaterialThemeColors)

Forces the MaterialRadioButton to use colors from a Material Theme.

Protected methods

void onAttachedToWindow()

Inherited methods

Public constructors

MaterialRadioButton

public MaterialRadioButton (Context context)

Parameters
context Context

MaterialRadioButton

public MaterialRadioButton (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

MaterialRadioButton

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

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

isUseMaterialThemeColors

public boolean isUseMaterialThemeColors ()

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

Returns
boolean

setUseMaterialThemeColors

public 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 AppCompatRadioButton.setSupportButtonTintList(ColorStateList) to change button tints.

Parameters
useMaterialThemeColors boolean

Protected methods

onAttachedToWindow

protected void onAttachedToWindow ()