OptionGroup - OneUIProject/OneUI-Design-Library GitHub Wiki

de.dlyt.yanndroid.oneui.view.OptionGroup

OptionButton and OptionGroup are working together like RadioButton and RadioGroup. It will select an OptionButton on click.

<de.dlyt.yanndroid.oneui.view.OptionGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:selectedOptionButton="...">

    <de.dlyt.yanndroid.oneui.widget.OptionButton
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:icon="..."
        app:text="..." />

    ...

</de.dlyt.yanndroid.oneui.view.OptionGroup>

app:selectedOptionButton="..." will set the default selected OptionButton with this id. This view can also have other children, for example a divider:

<View style="@style/DrawerDividerStyle" />

Methods

Select an OptionButton with either the view, id or position.

public void setSelectedOptionButton(OptionButton optionButton)
public void setSelectedOptionButton(Integer id)
public void setSelectedOptionButton(int position)

Get the currently selected OptionButton.

public OptionButton getSelectedOptionButton()

Listener which will provide you view, id and position of the clicked OptionButton.

public void setOnOptionButtonClickListener(OnOptionButtonClickListener listener)