|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.view.ViewGroup
android.widget.LinearLayout
android.widget.RadioGroup
public class RadioGroup
This class is used to create a multiple-exclusion scope for a set of radio buttons. Checking one radio button that belongs to a radio group unchecks any previously checked radio button within the same group.
Intially, all of the radio buttons are unchecked. While it is not possible to uncheck a particular radio button, the radio group can be cleared to remove the checked state.
The selection is identified by the unique id of the radio button as defined in the XML layout file.
XML Attributes
See RadioGroup Attributes,
LinearLayout Attributes,
ViewGroup Attributes,
View Attributes
Also see
LinearLayout.LayoutParams
for layout attributes.
RadioButton| Nested Class Summary | |
|---|---|
static class |
RadioGroup.LayoutParams
This set of layout parameters defaults the width and the height of the children to ViewGroup.LayoutParams.WRAP_CONTENT when they are not specified in the
XML file. |
static interface |
RadioGroup.OnCheckedChangeListener
Interface definition for a callback to be invoked when the checked radio button changed in this group. |
| Nested classes/interfaces inherited from class android.view.ViewGroup |
|---|
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener |
| Nested classes/interfaces inherited from class android.view.View |
|---|
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener |
| Field Summary |
|---|
| Fields inherited from class android.widget.LinearLayout |
|---|
HORIZONTAL, VERTICAL |
| Constructor Summary | |
|---|---|
RadioGroup(Context context)
|
|
RadioGroup(Context context,
AttributeSet attrs)
|
|
| Method Summary | |
|---|---|
void |
check(int id)
Sets the selection to the radio button whose identifier is passed in parameter. |
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p)
|
void |
clearCheck()
Clears the selection. |
protected LinearLayout.LayoutParams |
generateDefaultLayoutParams()
Returns a set of layout parameters with a width of ViewGroup.LayoutParams.FILL_PARENT
and a height of ViewGroup.LayoutParams.WRAP_CONTENT
when the layout's orientation is LinearLayout.VERTICAL. |
RadioGroup.LayoutParams |
generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set. |
int |
getCheckedRadioButtonId()
Returns the identifier of the selected radio button in this group. |
protected void |
onFinishInflate()
Finalize inflating a view from XML. |
void |
setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener listener)
Register a callback to be invoked when the checked radio button changes in this group. |
void |
setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
Register a callback to be invoked when a child is added to or removed from this view. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface android.view.ViewParent |
|---|
createContextMenu, getParent, isLayoutRequested, requestLayout |
| Constructor Detail |
|---|
public RadioGroup(Context context)
public RadioGroup(Context context,
AttributeSet attrs)
| Method Detail |
|---|
public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
setOnHierarchyChangeListener in class ViewGrouplistener - the callback to invoke on hierarchy changeprotected void onFinishInflate()
Even if the subclass overrides onFinishInflate, they should always be sure to call the super method, so that we get called.
onFinishInflate in class Viewpublic void check(int id)
Sets the selection to the radio button whose identifier is passed in
parameter. Using -1 as the selection identifier clears the selection;
such an operation is equivalent to invoking clearCheck().
id - the unique id of the radio button to select in this groupgetCheckedRadioButtonId(),
clearCheck()public int getCheckedRadioButtonId()
Returns the identifier of the selected radio button in this group. Upon empty selection, the returned value is -1.
check(int),
clearCheck()public void clearCheck()
Clears the selection. When the selection is cleared, no radio button
in this group is selected and getCheckedRadioButtonId() returns
null.
check(int),
getCheckedRadioButtonId()public void setOnCheckedChangeListener(RadioGroup.OnCheckedChangeListener listener)
Register a callback to be invoked when the checked radio button changes in this group.
listener - the callback to call on checked state changepublic RadioGroup.LayoutParams generateLayoutParams(AttributeSet attrs)
generateLayoutParams in class LinearLayoutattrs - the attributes to build the layout parameters from
ViewGroup.LayoutParams or one
of its descendantsprotected boolean checkLayoutParams(ViewGroup.LayoutParams p)
checkLayoutParams in class LinearLayoutprotected LinearLayout.LayoutParams generateDefaultLayoutParams()
LinearLayoutViewGroup.LayoutParams.FILL_PARENT
and a height of ViewGroup.LayoutParams.WRAP_CONTENT
when the layout's orientation is LinearLayout.VERTICAL. When the orientation is
LinearLayout.HORIZONTAL, the width is set to ViewGroup.LayoutParams.WRAP_CONTENT
and the height to ViewGroup.LayoutParams.WRAP_CONTENT.
generateDefaultLayoutParams in class LinearLayout
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||