给大家分享一个特别简单的一个Dialog,不需要布局,只需一个方法就能搞定,会在以后的项目开发中为大家省一部分时间
ProgressDialog mProgressDialog = ProgressDialog.show(MainActivity.this, "提示", "正在登陆中", true,
true, new DialogInterface.OnCancelListener() {
//点击监听,当点击空白地方时Dialog就消失
@Overridepublic void onCancel(DialogInterface dialog) {
Toast.makeText(MainActivity.this, "进度条被取消",
Toast.LENGTH_SHORT).show();
}
});
mProgressDialog.onStart();