# MaterialRadioButton

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/radiobutton/MaterialRadioButton.java)

*** ** * ** ***


```
public class MaterialRadioButton
```

<br />

*** ** * ** ***

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.

For more information, see the [component developer guidance](https://github.com/material-components/material-components-android/blob/master/docs/components/RadioButton.md) and [design guidelines](https://material.io/components/radio-button/overview).

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton#MaterialRadioButton(Context)(Context context)` |
| `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton#MaterialRadioButton(Context,AttributeSet)(Context context, AttributeSet attrs)` |
| `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton#MaterialRadioButton(Context,AttributeSet,int)( Context context, AttributeSet attrs, int defStyleAttr )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton#isUseMaterialThemeColors()()` Returns true if this `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton` defaults to colors from a Material Theme. |
| `void` | `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton#setUseMaterialThemeColors(boolean)(boolean useMaterialThemeColors)` Forces the `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton` to use colors from a Material Theme. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton#onAttachedToWindow()()` |

## Public constructors

### MaterialRadioButton

```
public MaterialRadioButton(Context context)
```

### MaterialRadioButton

```
public MaterialRadioButton(Context context, AttributeSet attrs)
```

### MaterialRadioButton

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

## Public methods

### isUseMaterialThemeColors

```
public boolean isUseMaterialThemeColors()
```

Returns true if this `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton` defaults to colors from a Material Theme.

### setUseMaterialThemeColors

```
public void setUseMaterialThemeColors(boolean useMaterialThemeColors)
```

Forces the `https://developer.android.com/reference/com/google/android/material/radiobutton/MaterialRadioButton` to use colors from a Material Theme. Overrides any specified ButtonTintList. If set to false, sets the tints to null. Use setSupportButtonTintList to change button tints.

## Protected methods

### onAttachedToWindow

```
protected void onAttachedToWindow()
```