【发布时间】:2016-12-26 12:51:54
【问题描述】:
我只想在单击单选按钮时在屏幕上显示微调器,但我找不到解决方案。这是我当前的代码。
RadioGroup radio_grp=(RadioGroup) rootView.findViewById(R.id.radio_grp);
RadioButton rb1 = (RadioButton) rootView.findViewById(R.id.radioButton1);
RadioButton rb2 = (RadioButton) rootView.findViewById(R.id.radioButton2);
View.OnClickListener button1Listener = new View.OnClickListener() {
public void onClick(View v) {
// Toast message etc.
}
};
View.OnClickListener button2Listener = new View.OnClickListener() {
public void onClick(View v) {
// I want to show a spinner if they click the second radio button
}
};
rb1.setOnClickListener(button1Listener);
rb2.setOnClickListener(button2Listener);
return rootView;
【问题讨论】:
-
使用属性 visibility='gone' 或 'invisible' 的微调器设计您的布局文件,当您单击单选按钮时使其可见
标签: java android android-spinner visibility android-radiobutton