1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| new AlertDialog.Builder(this) .setTitle("请选择") .setIcon(android.R.drawable.ic_dialog_info) .setSingleChoiceItems(new String[]{"选项1","选项2","选项3","选项4","选项5","选项6"}, -1, new DialogInterface.OnClickListener(){ public void onClick(DialogInterface arg0, int arg1) { switch (arg1) { case 0:Log.d(TAG, "选择了一");break; case 1:Log.d(TAG, "选择了二");break; case 2:Log.d(TAG, "选择了三");break; case 3:Log.d(TAG, "选择了四");break; case 4:Log.d(TAG, "选择了五");break; case 5:Log.d(TAG, "选择了六");break; default: break; } arg0.dismiss(); } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) {
} }).show();
|