Android开发之RadioButton和CheckBox
如下图像是整体的布局

这是main.xml
run.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {// TODO Auto-generated method stubif(isChecked){//System.out.println("run checked");Toast.makeText(radioTest.this, "感觉很好!", Toast.LENGTH_LONG).show();}else{//System.out.println("run unchecked");Toast.makeText(radioTest.this, "坑爹啊!", Toast.LENGTH_LONG).show();}}});从中我们可以看到单选按钮触发事件是绑定到了RadioGroup上面,而多选按钮是绑定到了每一个多选按钮上。此外,我们看到还有Toast,这是一个提示消息,就像上面图像里的一样,用法很简单,就是一句话
Toast.makeText(radioTest.this, "我是美女", Toast.LENGTH_LONG).show();
我们依葫芦画瓢就可以了