Components
Radio Button
Buttons are used to select only one of a limited number of choices
Usage
Radio buttons allow the user to select one option from a dataset.
Variant
Themes
There are 2 themes of the radio button. There are Primary
and Secondary
.
Base Components
Single radio button used for single option value.
Primary Radio Button
Example usage :
Static in xml
<com.telkom.legion.component.radio.LgnPrimaryRadioButtonandroid:id="@+id/rbprimary"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="Radio Button Primary"android:layout_marginHorizontal="@dimen/dimen_16dp"android:layout_marginTop="@dimen/dimen_16dp"/>
Dynamic using Kotlin*
...with(binding) {rbprimary.setText("Primary Radio Button from kotlin")rbprimary.isChecked}...
Secondary Radio Button
Example usage :
Static in xml
<com.telkom.legion.component.radio.LgnSecondaryRadioButtonandroid:id="@+id/rbsecondary"android:layout_width="match_parent"android:layout_height="wrap_content"android:text="Radio Button Secondary"android:layout_marginHorizontal="@dimen/dimen_16dp"android:layout_marginTop="@dimen/dimen_16dp"/>
Dynamic using Kotlin*
...with(binding) {rbsecondary.setText("Secondary Radio Button from kotlin")rbsecondary.disable()}...
Attributes
Attribute Name | Xml Attrs | Related method(s) | Description |
---|---|---|---|
Id | android:id | text | To set id component |
Text | android:text | text | To set Text value directly via xml |
Enable Status | android:enabled | isEnable | To set enable or disable radio button value directly via xml |
Radio Button Group
Radio button group used for show multiple option value.
Example usage :
Static in xml
<TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="Radio Button Example"android:layout_marginHorizontal="@dimen/dimen_16dp"android:layout_marginTop="@dimen/dimen_16dp"android:textAppearance="?attr/bodyLargeMedium"/><TextView
Dynamic using Kotlin*
......with(binding) {rgSamplePrimary.addAll(listOf("Sick","Not Fit","Healthy"),
Attributes
Attribute Name | Xml Attrs | Related method(s) | Description |
---|---|---|---|
Id | android:id | text | To set id component |
Text | android:text | text | To set Text value directly via xml |
Enable Status | android:enabled | isEnable | To set enable or disable radio button value directly via xml |
Show Dividers | android:showDividers | showDividers | To show devider between radio button value |
Radio Button Container
Radio group container contains radio button group, hits ( label), helper , and error text.
Example usage :
Static in xml
<TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="Radio Button Container"android:layout_marginHorizontal="@dimen/dimen_16dp"android:layout_marginTop="@dimen/dimen_16dp"android:textAppearance="?attr/bodyLargeMedium"/><com.telkom.legion.component.radio.LgnPrimaryRadioContainer
Dynamic using Kotlin*
......with(binding) {rcPrimary.addAll(listOf("Sample 1","Sample 2","Sample 3","Sample 4",
Attributes
Attribute Name | Xml Attrs | Related method(s) | Description |
---|---|---|---|
Helper Text in Container | app:helperText | helperText | To set helper text below radio button container |
Hint | android:hint | hint | To set label for radio button container |
Orientation | android:orientation | orientation | To set orientation dataset for radio button container |
Scroll Container | android:isScrollContainer | isScrollContainer | To set enable or disable scroll dataset for radio button container |
Do you have feedback?
Please let us know to make it better