I want to set the visibility of a RadioButton to INVISIBLE or GONE. For some reason this isn't working.
RadioButton myRadioButton = (RadioButton) findViewById(R.id.my_radio_button_id);
myRadioButton.setVisibility(View.GONE);
or
myRadioButton.setVisibility(View.INVISIBLE);
No error is returned, it just doesn't do anything.
However I have tried this on the RadioGroup
RadioGroup myRadioGroup = (RadioGroup) findViewById(R.id.radiogroup_quiz_answers);
myRadioGroup.setVisibility(View.INVISIBLE);
And it works fine to hide the whole group. Is there a way to just hide one of the RadioButtons? I have a group of 3 which are answers to questions but in some cases I want to hide the last one.