android加載框效果,本例子有幾種效果彈出dialog,本例子主要自定義SVProgressHUD 類,
本例子來源:https://github.com/saiwu-bigkoo/Android-SVProgressHUD
主要代碼以下:html
public enum SVProgressHUDMaskType {
None, // 容許遮罩下面控件點擊
Clear, // 不容許遮罩下面控件點擊
Black, // 不容許遮罩下面控件點擊,背景黑色半透明
Gradient, // 不容許遮罩下面控件點擊,背景漸變半透明
ClearCancel, // 不容許遮罩下面控件點擊,點擊遮罩消失
BlackCancel, // 不容許遮罩下面控件點擊,背景黑色半透明,點擊遮罩消失
GradientCancel // 不容許遮罩下面控件點擊,背景漸變半透明,點擊遮罩消失
;android
}git
//建立實例並初始化github
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();
}app
return mSVProgressHUD;
}ide
經過加裝dialog動畫動畫
Animation.AnimationListener outAnimListener = new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) { }spa
@Override
public void onAnimationEnd(Animation animation) {
dismissImmediately();
}設計
@Override
public void onAnimationRepeat(Animation animation) {
}
};code