private Dialog buildDialog2(Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setIcon(R.drawable.alert_dialog_icon); builder.setTitle(R.string.alert_dialog_two_buttons_msg); builder.setMessage(R.string.alert_dialog_two_buttons2_msg); builder.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { setTitle("点击了对话框上的确定按钮"); } }); builder.setNeutralButton(R.string.alert_dialog_something, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { setTitle("点击了对话框上的进入详细按钮"); } }); builder.setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { setTitle("点击了对话框上的取消按钮"); } }); return builder.create(); }
Android手机开发:Dialog的使用
内容版权声明:除非注明,否则皆为本站原创文章。