0

I'm trying to create a RadioGroup with RadioButtons that have more than text only. The image below will make things easier to understand. enter image description here

I want the RadioButton to be selected when the user clicks somewhere in the layout around it. I've tried do do somthing lik this:

<RadioGroup>
    <RelativeLayout>
        <RadioButton>
        <...other stuff>
    </RelativeLayout>
</RadioGroup>

But that didn't work. Does somebody know how to easily get the requested layout and behaviour? Thanks

EDIT:

I forgot to mention that I don't want to use a list. I want all items to be visible because there are maximum three. Also, the container is a ScrollView

dumazy
  • 13,857
  • 12
  • 66
  • 113

1 Answers1

0

As Der Golem said you can use ListView and set it to be in a single choice mode: list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

But if you need only few layouts you can register Click listener to your layouts and call onClick events on RadioButtons:

 bigLayout.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    radioButton.performClick();
                }
            });

Hope it will help

Shamm
  • 1,004
  • 7
  • 9