今天写了一些后台的配置,完善了登录验证的问题
public static Dialog showWaitDialog(Context context, String msg, boolean isTransBg, boolean isCancelable) {
LayoutInflater inflater = LayoutInflater.from(context);
View v = inflater.inflate(R.layout.login_dialog_loading, null); // 得到加载view
RelativeLayout layout = (RelativeLayout) v.findViewById(R.id.dialog_view);// 加载布局
// main.xml中的ImageView
ImageView spaceshipImage = (ImageView) v.findViewById(R.id.img);
TextView tipTextView = (TextView) v.findViewById(R.id.tipTextView); // 提示文字
// 加载动画
Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(context, R.anim.rotate_animation);
// 使用ImageView显示动画
spaceshipImage.startAnimation(hyperspaceJumpAnimation);
tipTextView.setText(msg);// 设置加载信息
Dialog loadingDialog = new Dialog(context, isTransBg ? R.style.TransDialogStyle : R.style.WhiteDialogStyle); // 创建自定义样式dialog
loadingDialog.setContentView(layout);
loadingDialog.setCancelable(isCancelable);
loadingDialog.setCanceledOnTouchOutside(false);
Window window = loadingDialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
window.setGravity(Gravity.CENTER);
window.setAttributes(lp);
window.setWindowAnimations(R.style.PopWindowAnimStyle);
loadingDialog.show();
return loadingDialog;