private void init() {
    progress = new SweetProgress(getContext());
    final int edges = UIUtils.dip2px(getContext(), 32);
    LayoutParams params = new LayoutParams(edges, edges);
    params.gravity = Gravity.CENTER;
    final int margin = UIUtils.dip2px(getContext(), 8);
    params.setMargins(0, margin, 0, margin);
    addView(progress, params);

    getViewTreeObserver()
        .addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {
              @Override
              public void onGlobalLayout() {
                moveTo(0);
                getViewTreeObserver().removeGlobalOnLayoutListener(this);
              }
            });
  }