【发布时间】:2013-10-01 05:34:14
【问题描述】:
我想将 RadioButton 的可见性设置为 INVISIBLE 或 GONE。由于某种原因,这不起作用。
RadioButton myRadioButton = (RadioButton) findViewById(R.id.my_radio_button_id);
myRadioButton.setVisibility(View.GONE);
或
myRadioButton.setVisibility(View.INVISIBLE);
没有返回错误,它只是不做任何事情。
不过我在 RadioGroup 上试过这个
RadioGroup myRadioGroup = (RadioGroup) findViewById(R.id.radiogroup_quiz_answers);
myRadioGroup.setVisibility(View.INVISIBLE);
隐藏整个组也很好。有没有办法只隐藏一个 RadioButtons?我有一组 3 个问题的答案,但在某些情况下我想隐藏最后一个。
【问题讨论】:
标签: android android-view