Android——ProgressDialog

ProgressDialog mProgressDialog = new ProgressDialog(context);
		mProgressDialog.setMessage(context.getString(mLoadingMsg));
		mProgressDialog.setIndeterminate(true);
		mProgressDialog.setCancelable(true);
		Window window = mProgressDialog.getWindow();
		WindowManager.LayoutParams lp = window.getAttributes();
		lp.alpha = 0.7f;// 透明度
		lp.dimAmount = 0.8f;// 黑暗度
		window.setAttributes(lp);
		mProgressDialog.setOnCancelListener(new OnCancelListener() {
			@Override
			public void onCancel(DialogInterface dialog) {
				/** 取消Dialog时,关闭当前Task */
				LoadingTask.this.cancel(true);
			}
		});
 

你可能感兴趣的:(android)