FileDocCategorySizeDatePackage
RadioButton.javaAPI DocAndroid 1.5 API2337Wed May 06 22:41:56 BST 2009android.widget

RadioButton

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

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

XML attributes

See {@link android.R.styleable#CompoundButton CompoundButton Attributes}, {@link android.R.styleable#Button Button Attributes}, {@link android.R.styleable#TextView TextView Attributes}, {@link android.R.styleable#View View Attributes}

Fields Summary
Constructors Summary
public RadioButton(android.content.Context context)

        this(context, null);
    
public RadioButton(android.content.Context context, android.util.AttributeSet attrs)

        this(context, attrs, com.android.internal.R.attr.radioButtonStyle);
    
public RadioButton(android.content.Context context, android.util.AttributeSet attrs, int defStyle)

        super(context, attrs, defStyle);
    
Methods Summary
public voidtoggle()
{@inheritDoc}

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

        // we override to prevent toggle when the radio is already
        // checked (as opposed to check boxes widgets)
        if (!isChecked()) {
            super.toggle();
        }