标签:
public class DialogUtil {
public static ProgressDialogView progressDialog;/*** 显示对话框的方法,String类型* @param context 句柄* @param title 标题* @param message 内容* @param view 视图* @param positive 左边的按钮文字* @param neutral 中间的按钮文字* @param negative 右边的按钮文字* @param positiveListener 左边按钮的监听器* @param neutralListener 中间按钮的监听器* @param negativeListener 右边按钮的监听器*/public static void showDialog(Context context, String title, String message, View view, String positive, String neutral,String negative, OnClickListener positiveListener, OnClickListener neutralListener, OnClickListener negativeListener) {new AlertDialog.Builder(context).setTitle(title).setMessage(message).setView(view).setPositiveButton(positive, positiveListener).setNeutralButton(neutral, neutralListener).setNegativeButton(negative, negativeListener).create().show();}/*** 显示简单的带进度条对话框* @param context 句柄* @param title 标题* @param message 内容* @param cancelable 是否可以取消*/public static void showProgressDialog(Context context, String title, String message, boolean cancelable, OnCancelListener cancelListener) {dismissProgressDialog();progressDialog = new ProgressDialogView(context);progressDialog.setTitle(title);progressDialog.setMessage(message);progressDialog.setCancelable(cancelable);progressDialog.setOnCancelListener(cancelListener);progressDialog.show();}/*** 取消带进度条的对话框*/public static void dismissProgressDialog() {if (progressDialog != null && progressDialog.isShowing()) {try {progressDialog.dismiss();} catch (IllegalArgumentException e) {}}progressDialog = null;}}
标签:
原文地址:http://www.cnblogs.com/baiqiantao/p/5389586.html