public class

RadioGroup

extends View
java.lang.Object
   ↳ com.neomades.ui.View
     ↳ com.neomades.ui.RadioGroup

Class Overview

A RadioGroup is a group of RadioButton.

It ensures that only one button in the group is checked at the same time. When a RadioButton is added to the group it is always unchecked.

RadioButton of the group can be checked or unchecked in source code using setChecked(boolean) or put all unchecked using clear().

By default, a RadioGroup is stretched in MATCH_PARENT in width and MATCH_CONTENT in height. It ensures that the RadioGroup height will grow as items are added into it.

Handling selection changes

Default properties

Cross Platform Considerations

In Android, a RadioGroup is a android.widget.RadioGroup. It will contain android.widget.RadioButton ( see RadioButton ). There is nothing "physical" that represents the group by default. Use background methods (such as setBackgroundImage(int)) to customize the group visual aspect.

In iOS, a RadioGroup is a UITableViewController with style UITableViewCellStyleDefault. This default style will represent the RadioGroup as a table with rounded corners. Each items will be separated by lines. Using a customized background will replace the default style (the default border and lines will be hidden). It will contain UITableViewCell (see RadioButton).

See Also

Summary

[Expand]
Inherited XML Attributes
From class com.neomades.ui.View
[Expand]
Inherited Constants
From interface com.neomades.ui.Alignment
From interface com.neomades.ui.StretchMode
Public Constructors
RadioGroup()
Constructs a RadioGroup with no RadioButtons inside.
Public Methods
RadioGroup addButton(RadioButton button)
Adds a radio button to this group.
void clear()
Clear the selection.
RadioButton getSelected()
Returns the current selected item of this RadioGroup.
[Expand]
Inherited Methods
From class com.neomades.ui.View
From class java.lang.Object

Public Constructors

public RadioGroup ()

Constructs a RadioGroup with no RadioButtons inside.

Public Methods

public RadioGroup addButton (RadioButton button)

Adds a radio button to this group.

Parameters
button the button to add
Returns
  • a reference to this radio group
Throws
CrossThreadException if the method is called from outside the UI-Thread

public void clear ()

Clear the selection. All items of the group are set unselected.

Throws
CrossThreadException if the method is called from outside the UI-Thread

public RadioButton getSelected ()

Returns the current selected item of this RadioGroup.

Returns
  • the selected button, null if none is selected