Radiogroup添加到Edittext

radiogroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {


@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
// TODO Auto-generated method stub

// 獲取選中項的ID
int radioButtonId = group.getCheckedRadioButtonId();
// 根據ID獲取RadioButton的實例
RadioButton rb = (RadioButton) SecondActivity.this
.findViewById(radioButtonId);
// 更新文本內容,以符合選中項
idText1.setText("您選擇學習的課程是:" + rb.getText());

}
});
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章