public void initView(Context context) {
    mContext = context;
    setGravity(Gravity.CENTER);
    setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    progressCon = new SimpleViewSwithcer(context);
    progressCon.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    AVLoadingIndicatorView progressView = new AVLoadingIndicatorView(this.getContext());
    progressView.setIndicatorColor(0xffB5B5B5);
    progressView.setIndicatorId(ProgressStyle.BallSpinFadeLoader);
    progressCon.setView(progressView);

    addView(progressCon);
    mText = new TextView(context);
    mText.setText("正在加载...");

    LayoutParams layoutParams =
        new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins((int) getResources().getDimension(R.dimen.textandiconmargin), 0, 0, 0);

    mText.setLayoutParams(layoutParams);
    addView(mText);
  }
 public void setProgressStyle(int style) {
   if (style == ProgressStyle.SysProgress) {
     progressCon.setView(new ProgressBar(mContext, null, android.R.attr.progressBarStyle));
   } else {
     AVLoadingIndicatorView progressView = new AVLoadingIndicatorView(this.getContext());
     progressView.setIndicatorColor(0xffB5B5B5);
     progressView.setIndicatorId(style);
     progressCon.setView(progressView);
   }
 }