Class RadioButton

All Implemented Interfaces:
Drawable.Callback, ViewTreeObserver.OnPreDrawListener, Checkable
Direct Known Subclasses:
MaterialRadioButton

public class RadioButton extends CompoundButton

A radio button is a two-states button that can be either checked or unchecked. When the radio button is unchecked, the user can press or click it to check it. However, contrary to a CheckBox, a radio button cannot be unchecked by the user once checked.

Radio buttons are normally used together in a RadioGroup. When several radio buttons live inside a radio group, checking one radio button unchecks all the others.

See the Radio Buttons guide.

  • Constructor Details

    • RadioButton

      public RadioButton(Context context)
  • Method Details

    • toggle

      public void toggle()
      Change the checked state of the view to the inverse of its current state

      If the radio button is already checked, this method will not toggle the radio button.

      Specified by:
      toggle in interface Checkable
      Overrides:
      toggle in class CompoundButton