Lon*_*Dev 3 android android-view
我想将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个问题的答案,但在某些情况下我想隐藏最后一个问题.
你可以用这种方式隐藏特定的单选按钮
RadioButton myRadioButton = (RadioButton) findViewById(R.id.last_radio);
myRadioButton.setVisibility(View.INVISIBLE);
或者,如果您使用View Gone menas单选按钮隐藏sapce
RadioButton myRadioButton = (RadioButton) findViewById(R.id.last_radio);
myRadioButton.setVisibility(View.GONE);
在这种情况下,不要隐藏无线电组
RadioGroup myRadioGroup = (RadioGroup) findViewById(R.id.radiogroup_quiz_answers);
myRadioGroup.setVisibility(View.Visible);
| 归档时间: | 
 | 
| 查看次数: | 10454 次 | 
| 最近记录: |