0

I want something like this. There could be passive multichoice buttons below all of the single choices. It doesn't matter. Is that possible?

Single and Multiple Choice Dialog

  • It would be helpful to show a bit of what you have tried so that those who are capable of helping can point you in the right direction. – Fabulous Aug 31 '18 at 21:59

1 Answers1

0

You can control visibility of every view with view.setVisibility(View.Visible or View.Gone). Set click listener on single choice button and use that method to show container layout with radio buttons.

chkIos.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View view) {        
    if (v.isChecked()) {
        multiChoiceView.setVisibility(View.VISIBLE);
    } else {
        multiChoiceView.setVisibility(View.GONE);
    }

});

To build a layout like on your picture you can combine RadioGroup with LinearLayout under each RadioButton, in this way:

<RadioGroup
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="20dp"
        android:orientation="vertical">

        <CheckBox
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <CheckBox
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </LinearLayout>

    <RadioButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</RadioGroup>
  • I added a picture. I get it how to make visible or gone but I don't know how to list below singlechoice –  Sep 01 '18 at 15:55
  • I can not change the view of dialogue after clicking on my trigger button. It crashes. There is no meaning of changing the view before appearing it. Because I have to get value, if the single button is checked or else. –  Sep 02 '18 at 22:14