先看效果:
实现步骤:
1、新建LoadingDialog类(可直接复制):
public class LoadingDialog extends Dialog {
public LoadingDialog(Context context) {
super(context, R.style.loading_dialog);
initView();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode){
case KeyEvent.KEYCODE_BACK:
if(LoadingDialog.this.isShowing())
LoadingDialog.this.dismiss();
break;
}
return true;
}
private void initView(){
setContentView(R.layout.dialog_loading);
Animation animation = AnimationUtils.loadAnimation(getContext(), R.anim.loading_animation);
animation.setInterpolator(new LinearInterpolator());
fi