0
我有我的單選按鈕的問題,因爲它顯示在myLayout而不是在alertDialog中的收音機組,我試圖做到這一點,但我無法弄清楚如何把它,因爲我是全新的在android中。與alertDialog Radiobuttons
View myView = getLayoutInflater().inflate(R.layout.radiogroup, null);
setContentView(myView);
RadioGroup myRadioGroup = (RadioGroup)
myView.findViewById(R.id.radioGroup);
int radioGroupId = myRadioGroup.getCheckedRadioButtonId();
RadioButton myCheckedButton = (RadioButton)
myView.findViewById(radioGroupId);
int index = myRadioGroup.indexOfChild(myCheckedButton);
new AlertDialog.Builder(this)
.setMessage("Choose Startup Color:")
.setPositiveButton("Set Startup Color", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
}
})
.show();
您忘記發佈您的代碼。如果您可以發佈您的代碼,我們可能會幫助您。 – MilesDyson
我正在添加整個細節:P – jaimito