MNProgressHUD
介绍:
MNProgressHUD常用的自定义弹框封装,加载ProgressDialog,状态显示的StatusDialog和自定义Toast,支持背景颜色,圆角,边框和文字的自定义。
运行效果:
使用说明:
1:Gradle添加:
1.在Project的build.gradle中添加仓库地址
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
2.在app目录下的build.gradle中添加依赖
dependencies {
compile 'com.github.maning0303:MNProgressHUD:V1.0.1'
}
2:源码Module添加:
直接关联mndialoglibrary
compile project(':mndialoglibrary')
使用方法(查看Demo详情):
1:MProgressDialog 加载Dialog代码使用:
//新建一个Dialog
mMProgressDialog = new MProgressDialog.Builder(this)
.isCanceledOnTouchOutside(true)
.setBackgroundWindowColor(getMyColor(R.color.colorDialogWindowBg))
.setBackgroundViewColor(getMyColor(R.color.colorDialogViewBg))
.setCornerRadius(20)
.setProgressColor(getMyColor(R.color.colorDialogProgressBarColor))
.setProgressWidth(3)
.setStrokeColor(getMyColor(R.color.colorAccent))
.setStrokeWidth(2)
.setTextColor(getMyColor(R.color.colorDialogTextColor))
.setOnDialogDismissListener(new MProgressDialog.OnDialogDismissListener() {
@Override
public void dismiss() {
//关闭监听
}
})
.build()
;
mMProgressDialog.show();
2:MStatusDialog 状态Dialog代码使用:
MStatusDialog mMStatusDialog = new MStatusDialog.Builder(mContext)
//
.setBackgroundWindowColor(getMyColor(R.color.colorDialogWindowBg))
.setBackgroundViewColor(getMyColor(R.color.colorDialogViewBg2))
.setTextColor(getMyColor(R.color.colorAccent))
.setStrokeColor(getMyColor(R.color.white))
.setStrokeWidth(2)
.setCornerRadius(10)
.build();
mMStatusDialog.show("提交数据失败,请重新尝试!", mContext.getResources().getDrawable(R.mipmap.ic_launcher), 1000);
3:MToast 代码使用:
MToastConfig config = new MToastConfig.Builder()
//设置显示的位置
.setGravity(MToastConfig.MToastGravity.CENTRE)
//文字的颜色
.setTextColor(getMyColor(R.color.colorAccent))
//背景色
.setBackgroundColor(getMyColor(R.color.colorDialogTest))
//背景圆角
.setBackgroundCornerRadius(10)
//背景边框的颜色
.setBackgroundStrokeColor(Color.WHITE)
//背景边框的宽度
.setBackgroundStrokeWidth(1)
.build();
//多种方法
MToast.makeTextShort(mContext, "", config).show();
已下载
0