我正在用复选框构建一个警报对话框。每当我将消息设置为任何内容(即使是像“我的味精”这样的短消息),对话框也只显示标题和取消按钮。对话框的中间部分是空白的白色。没有显示。代码如下。任何想法为什么对话显示空白空白?为什么它不显示我的信息?Android Alert对话框显示不正确 - 消息为空?
@Override
protected Dialog onCreateDialog(int id){
switch(id){
case MY_DIALOG:
return new AlertDialog.Builder(this)
.setIcon(R.drawable.identification_icon)
.setTitle("My Title")
.setMessage("short msg")
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
})
.setMultiChoiceItems(ackOptions, ackOptChecked, new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
// TODO Auto-generated method stub
}
}).create();
}
return null;
}
http://stackoverflow.com/questions/7861279/how-to-set-single-choice-items-inside-alertdialog – 2012-03-01 17:12:55
你无法做到这一点因为你的消息地点是由Choice选择的,因此请创建prblm – 2012-03-01 17:13:32