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);
   }
 }
 public void setState(int state) {
   switch (state) {
     case STATE_LAODING:
       progressCon.setVisibility(View.VISIBLE);
       mText.setText(mContext.getText(R.string.listview_loading));
       this.setVisibility(View.VISIBLE);
       break;
     case STATE_COMPLETE:
       mText.setText(mContext.getText(R.string.listview_loading));
       this.setVisibility(View.GONE);
       break;
     case STATE_NOMORE:
       mText.setText(mContext.getText(R.string.nomore_loading));
       progressCon.setVisibility(View.GONE);
       this.setVisibility(View.VISIBLE);
       break;
   }
 }