Added in API level 1

RadioButton

open class RadioButton : CompoundButton
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.Button
   ↳ android.widget.CompoundButton
   ↳ android.widget.RadioButton

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 android.widget.CheckBox, a radio button cannot be unchecked by the user once checked.

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

See the Radio Buttons guide.

XML attributes

See CompoundButton Attributes, Button Attributes, TextView Attributes, View Attributes

Summary

Inherited XML attributes
Inherited constants
Public constructors
RadioButton(context: Context!)

RadioButton(context: Context!, attrs: AttributeSet!)

RadioButton(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

RadioButton(context: Context!, attrs: AttributeSet!, defStyleAttr: Int, defStyleRes: Int)

Public methods
open CharSequence!

open Unit

open Unit

Change the checked state of the view to the inverse of its current state

Inherited functions
Inherited properties

Public constructors

RadioButton

Added in API level 1
RadioButton(context: Context!)

RadioButton

Added in API level 1
RadioButton(
    context: Context!,
    attrs: AttributeSet!)

RadioButton

Added in API level 1
RadioButton(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int)

RadioButton

Added in API level 1
RadioButton(
    context: Context!,
    attrs: AttributeSet!,
    defStyleAttr: Int,
    defStyleRes: Int)

Public methods

getAccessibilityClassName

Added in API level 23
open fun getAccessibilityClassName(): CharSequence!

onInitializeAccessibilityNodeInfo

Added in API level 14
open fun onInitializeAccessibilityNodeInfo(info: AccessibilityNodeInfo!): Unit
Parameters
info AccessibilityNodeInfo!: The instance to initialize.

toggle

Added in API level 1
open fun toggle(): Unit

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.