标签:
android加载框效果,本例子有几种效果弹出dialog,本例子主要自定义SVProgressHUD 类,
本例子来源:https://github.com/saiwu-bigkoo/Android-SVProgressHUD
主要代码如下:
public enum SVProgressHUDMaskType {
None, // 允许遮罩下面控件点击
Clear, // 不允许遮罩下面控件点击
Black, // 不允许遮罩下面控件点击,背景黑色半透明
Gradient, // 不允许遮罩下面控件点击,背景渐变半透明
ClearCancel, // 不允许遮罩下面控件点击,点击遮罩消失
BlackCancel, // 不允许遮罩下面控件点击,背景黑色半透明,点击遮罩消失
GradientCancel // 不允许遮罩下面控件点击,背景渐变半透明,点击遮罩消失
;
}
//创建实例并初始化
private static final SVProgressHUD getInstance(Context context) {
if (mSVProgressHUD == null) {
mSVProgressHUD = new SVProgressHUD();
mSVProgressHUD.context = context;
mSVProgressHUD.gravity = Gravity.CENTER;
mSVProgressHUD.initViews();
mSVProgressHUD.initDefaultView();
mSVProgressHUD.initAnimation();
}
if (context != null && context != mSVProgressHUD.context ){
mSVProgressHUD.context = context;
mSVProgressHUD.initViews();
}
return mSVProgressHUD;
}
通过加装dialog动画
Animation.AnimationListener outAnimListener = new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) { }
@Override
public void onAnimationEnd(Animation animation) {
dismissImmediately();
}
@Override
public void onAnimationRepeat(Animation animation) {
}
};
标签:
原文地址:http://my.oschina.net/u/2461971/blog/522443