package com.example.dialog;import android.app.ProgressDialog;import android.content.Context;/** * 自定义的加载中的对话框 * @author admin * */public class MyProgressDialog { private ProgressDialog mWaitDialog; private Context mContext; private boolean mIsShowDialog; public MyProgressDialog(Context context, Boolean showWaitingDialog) { this.mContext = context; this.mIsShowDialog = showWaitingDialog; if (mIsShowDialog) { // 创建ProgressDialog对象 mWaitDialog = new ProgressDialog(mContext); // 设置进度条风格,风格为圆形,旋转的 mWaitDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); // 设置ProgressDialog 的进度条是否不明确 mWaitDialog.setIndeterminate(false); // 设置ProgressDialog可以按返回键取消 mWaitDialog.setCancelable(true); } } public void show(String message) { // 设置ProgressDialog 提示信息 mWaitDialog.setMessage(message); mWaitDialog.show(); } public void hiden() { mWaitDialog.cancel(); }}